I have a user control with textbox and button which are bound to properties from viewmodel.
<Grid>
<StackPanel>
<TextBox Text=" Hi" IsEnabled="{Binding IsReadOnly, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Content="B" Visibility="{Binding IsVisible, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"></Button>
</StackPanel>
</Grid>
How to make the button invisible when the datacontext is not provided for this usercontrol?
FallbackValue
<Button Content="B" Visibility="{Binding IsVisible,
UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource BooleanToVisibilityConverter}},
FallbackValue=Collapsed"></Button>
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