You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe I am doing it wrong but AFAIK styles in WPF XAML parsed in such way that local style will always override any "top level" styles, in cases when this becomes an issue devs will be able to do: <Style TargetType="Button" Weight="1">Weight is something similar to Panel.ZIndex it will force style with higher weight to override any other styles even local style (any other more suitable word can be used instead of "Weight").
Another feature that might be useful is to be able to set visual tree level that style will be applied to, for example I have StackPanel and inside it I have borders with border in each border: [[]], I want to set global style in StackPanel.Resources that will set each "first level" only border's BorderBrush color to red, <Style TargetType="Border" VisualTreeDepth="1">VisualTreeDepth will limit how "deep" style override will apply, default value will be star (*) - all child elements
Or switch to CSS like styling (another discussion)
*Edit
Another feature that would be nice to have is to be able to set single property for Margin, Padding, BorderThickness etc
ex: <Border Margin.Top="1" BorderThickness.Top="2">
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Maybe I am doing it wrong but AFAIK styles in WPF XAML parsed in such way that local style will always override any "top level" styles, in cases when this becomes an issue devs will be able to do:
<Style TargetType="Button" Weight="1">
Weight is something similar to Panel.ZIndex it will force style with higher weight to override any other styles even local style (any other more suitable word can be used instead of "Weight").Another feature that might be useful is to be able to set visual tree level that style will be applied to, for example I have StackPanel and inside it I have borders with border in each border: [[]], I want to set global style in StackPanel.Resources that will set each "first level" only border's BorderBrush color to red,
<Style TargetType="Border" VisualTreeDepth="1">
VisualTreeDepth will limit how "deep" style override will apply, default value will be star (*) - all child elementsOr switch to CSS like styling (another discussion)
*Edit
Another feature that would be nice to have is to be able to set single property for Margin, Padding, BorderThickness etc
ex:
<Border Margin.Top="1" BorderThickness.Top="2">
Beta Was this translation helpful? Give feedback.
All reactions