我有一个简单的条件,一个名为 tbDestinationTableName 的文本框,当从 ComboBox cbConnection 进行任何选择时,它应该只允许用户输入。我目前在 codeBehind 中执行此操作。如果可以在 XAML 中完成,有人可以更正以下代码吗?
<ComboBox x:Name="cbConnection"
ItemsSource="{Binding Source={StaticResource XmlConnectionList}, XPath=//ComboItem}"
DisplayMemberPath="Key"
SelectedValuePath="Value"
SelectedValue="{Binding Path=ConnectionString,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}"
Margin="{StaticResource ConsistentMargins}"
/>
<kit:WatermarkTextBox Name="tbDestinationTableName" Margin="{StaticResource ConsistentMargins}"
TextChanged="tbDestinationTableName_TextChanged"
Text="{Binding Path=DestinationTableName, UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}"
Watermark="Destination Table"
IsEnabled="{Binding Path=ValidCreate}"/>