Replies: 3 comments 1 reply
-
|
Hi, As far as I can tell, you can do everything using both methods. |
Beta Was this translation helpful? Give feedback.
-
|
If you task is to create a custom control look, replacing existing one - use ControlTheme. |
Beta Was this translation helpful? Give feedback.
-
|
I discovered (for myself) one important point to chose between For example, if you have global (application level) <Style Selector="ListBoxItem">
<Setter Property="Padding" Value="20 5" />
</Style>and then somwhere in application create a <ListBox>
<ListBox.ItemContainerTheme>
<ControlTheme TargetType="{x:Type ListBoxItem}" BasedOn={StaticResource {x:Type ListBoxItem}}>
<Setter Property="Padding" Value="0" />
<ControlTheme />
</ListBox.ItemContainerTheme>
</ListBox>the <ControlTheme x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}" BasedOn={StaticResource {x:Type ListBoxItem}}>
<Setter Property="Padding" Value="20 5" />
</ControlTheme>all works as expected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an application, where I want to override default style of some control, e.g., I want all my menu items to have less vertical padding.
So, there's to ways to do this:
or
Which one is the most prefered?
Beta Was this translation helpful? Give feedback.
All reactions