How can I get the value of style setter property in xaml?
For example, I have next style:
<Style TargetType="TextBox">
<Setter Property="Background" Value="YellowGreen" />
</Style>
How can I get the value of Background property from TextBox default style?
<Style TargetType="Button">
<Setter Property="Background" Value="{Binding ???}" />
</Style>
I need this because I haven't access to TextBox
style..
If you can't modify TextBox style, you could do this work-around (tested, works):
<TextBox x:Key="DefaultTextBox" />
<Style TargetType="Button">
<Setter Property="Background"
Value="{Binding Source={StaticResource DefaultTextBox}, Path=Background}" />
</Style>
You cannot bind in xaml to style's setter for background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With