你能幫我找到在這一個錯誤:即使加載窗體窗體之前事件觸發。我開始看到消息框,然後單擊確定,之後它加載主屏幕。之後,一切正常,我不知道什麼觸發ComboBox SelectionChanged事件之前,甚至加載窗口.FillComboBoxFamilyData(SegmentCode)只是創建一個數據集並將值置於ComboBox中。請參閱此鏈接獲取完整的代碼。Combobox選擇更改事件觸發器,甚至沒有改變組合框中的選擇
Not able to make cascading comboboxes work
任何幫助將是非常appreciated.Thanks。
<ComboBox Height="23" HorizontalAlignment="Left" Margin="35,26,0,0" Name="comboBox1" VerticalAlignment="Top" Width="205" ItemsSource="{Binding Source={StaticResource tblSegmentViewSource}}" DisplayMemberPath="Segment Name" SelectedValuePath="Segment Code" SelectionChanged="comboBox1_SelectionChanged"/>
<ComboBox Margin="304,26,395,93" Name="comboBox2" />
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
MessageBox.Show(comboBox1.SelectedValue.ToString());
SegmentCode = Convert.ToInt32(comboBox1.SelectedValue.ToString());
FillComboBoxFamilyData(SegmentCode);
}
你寫的代碼,私人無效comboBox1_SelectionChanged(對象發件人,SelectionChangedEventArgs E),或者是由SDK產生的? – clamchoda 2011-02-16 21:17:57