我禁用组合,如果文本是空的,但一旦我选择了cbo和删除文本从文本框,cbo选定的项目仍然可见
<TextBox Name="txt0" PreviewTextInput="NumericOnly" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="70" Margin="52,83,0,0"/>
<ComboBox Name="cbo0" ItemsSource="{Binding Source={StaticResource enumValues}}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="77" Margin="144,84,0,0">
<ComboBox.Style>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="IsEnabled" Value="True" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=txt0, Path=Text}" Value="">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</ComboBox.Style>
</ComboBox>
1条答案
按热度按时间sulc1iza1#
我只需要加一个二传手