在我的.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; }
在此先感谢您的帮助!