Consider the following bit of code:
<UserControl x:Name=root>
....
<TextBlock Text="Hello World" Margin="{Binding ElementName=root, Path=LeftButtonMargin}"/>
....
</UserControl>
Now, what is the syntax for setting the FallBackvalue
on the Binding?
I've tried some different options already, but I cannot seem to find the correct syntax:
Margin="{Binding ElementName=root, Path=LeftButtonMargin, FallBackValue={}10,10,0,0}"
Margin="{Binding ElementName=root, Path=LeftButtonMargin, FallBackValue={}{10,10,0,0}}"
Margin="{Binding ElementName=root, Path=LeftButtonMargin, FallBackValue={}"10,10,0,0"}"
Or is this not possible at all? Basically, I need these values at design time...
More simple: use single quotes
Margin="{Binding ElementName=root, Path=LeftButtonMargin, FallBackValue='10,10,0,0'}"
Hopefully works,
<UserControl.Resources>
<Thickness x:Key="MyMargin" Bottom="5" Top="10">
</Thickness>
<UserControl.Resources>
<TextBlock Text="Hello World"
Margin="{Binding ...,FallBackValue={StaticResource MyMargin}}"/>
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