KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What I have is an object that has an IsReadOnly property. If this property is true, I would like to set the IsEnabled property on a Button, ( for example ), to false. I would like to believe that I can do it as easily as IsEnabled="{Binding Path=!IsReadOnly}" but that doesn't fly with WPF. Am I relegated to having to go through all of the style settings? Just seems too wordy for something as simple as setting one bool to the inverse of another bool. <Button.Style> <Style TargetType="{x:Type Button}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsReadOnly}" Value="True"> <Setter Property="IsEnabled" Value="False" /> </DataTrigger> <DataTrigger Binding="{Binding Path=IsReadOnly}" Value="False"> <Setter Property="IsEnabled" Value="True" /> </DataTrigger> </Style.Triggers> </Style> </Button.Style>
Tags (comma-separated)
Save Edits
Cancel