【发布时间】:2017-09-07 10:41:03
【问题描述】:
在我的 .xaml 文件中,我的组合框如下:
<ComboBox Name="CLengthCombo" SelectionChanged="ComboBox_SelectionChanged">
<ComboBoxItem Content="24"/>
<ComboBoxItem Content="25"/>
<ComboBoxItem Content="26" IsSelected="True"/>
<ComboBoxItem Content="27"/>
</ComboBox>
如何实现我的 ComboBox_SelectionChanged 事件,以便在应用程序运行时获取用户更改的 comboBoxItem 的内容?在这种情况下使用 SelectionChanged 事件是否正确?以下不起作用:
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ string chosenItem = CLengthCombo.PlaceholderText; }
在此先感谢您的帮助!
【问题讨论】: