在没有代码隐藏的情况下连接 keydown 事件有一点问题!所以,我们有组合框
<ComboBox Height="20" Width="auto"
ItemsSource="{Binding AlignComboItems}"
SelectedValue="{Binding SelectedComboItem, Mode=TwoWay}"
SelectedValuePath="Key" DisplayMemberPath="Value"
SelectedItem="{Binding SelectedItem}"
x:Name="cmbBoxAlign">
</ComboBox>
和一些文本框。
<TextBox Text={Binding SomeSource}></TextBox>
如何捕获 TextBox 上的 keydown 事件以选择(例如)ComboBox 中的最后一个元素?我不能使用 TextBox DataSource 属性更改,因为需要挂钩用户输入。