---
title: "Global Style in WPF?"  
description: "Global Style in WPF?"  
author: "Anonymous User"  
published: 2013-10-14  
updated: 2013-10-14  
canonical: https://www.mindstick.com/forum/1675/global-style-in-wpf  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# Global Style in WPF?

Is there a way to [setup](https://www.mindstick.com/articles/426/how-to-create-a-setup-project-for-windows-application) [global](https://www.mindstick.com/articles/13127/macro-and-microeconomics-concepts-in-relation-to-global-organization-management) styles for my [WPF](https://www.mindstick.com/forum/304/wpf) [application](https://www.mindstick.com/articles/12824/calculator-application-in-android)?

What I'm hoping to do is [apply](https://www.mindstick.com/articles/13148/discover-to-apply-make-up-like-a-professional-supermodel) a [style](https://www.mindstick.com/articles/126300/apa-citation-style-get-to-know-about-it-for-your-next-assignment) to all my Buttons that also have an [Image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) child.

## Replies

### Reply by Aaron Douglas

Well, sort of - it's a catch-all approach you can do - put the following element in your App.xaml - all your buttons will change (except the ones you apply a style to, manually).

```
<Style TargetType="{x:Type Button}">
    <Setter Property="Background" Value="LightPink"/> <!-- You should notice that one... -->
</Style>
```

\

However, if you want to hit only buttons with images - you have to inherit from Button everytime you do and then apply a style like this:

```
public class CustomImageButton:Button{}
<Style TargetType="{x:Type local:CustomImageButton}">
    <Setter Property="Background" Value="LimeGreen"/>
</Style>
<local:CustomImageButton Content="ClickMe"/>
```

It is a very coarse-grained global styling - and you need to follow the convention to make it work.


---

Original Source: https://www.mindstick.com/forum/1675/global-style-in-wpf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
