有多属性触发器 就有多数据触发器
- <Grid>
- <CheckBox x:Name="c1" Content="许可协议1" HorizontalAlignment="Left" Margin="151,157,0,0" VerticalAlignment="Top"/>
- <CheckBox x:Name="c2" Content="许可协议2" HorizontalAlignment="Left" Margin="151,178,0,0" VerticalAlignment="Top"/>
- <Button Content="注册" Click="Button_Click" HorizontalAlignment="Left" Margin="151,209,0,0" VerticalAlignment="Top" Width="75">
- <Button.Style>
- <Style TargetType="{x:Type Button}">
- <Setter Property="IsEnabled" Value="False"></Setter>
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding ElementName=c1,Path=IsChecked}" Value="True"></Condition>
- <Condition Binding="{Binding ElementName=c2,Path=IsChecked}" Value="True"></Condition>
- </MultiDataTrigger.Conditions>
- <MultiDataTrigger.Setters>
- <Setter Property="IsEnabled" Value="True"/>
- </MultiDataTrigger.Setters>
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </Button.Style>
- </Button>
- </Grid>
原文地址:https://www.cnblogs.com/lonelyxmas/p/12075488.html
时间: 2024-11-05 18:31:16