"SelectionChange"ComboBox에 대한 이벤트가 있습니다.선택한 색인의 텍스트 가져 오기 WPF ComboBox
- 을 나는 가능한 한 빨리
- 두 번째 콤보 상자는
- ComboBox2 반응해야 할 첫 번째 상자에서 선택한 항목에 따라 항목을 표시 두 가지 선택 상자를 가지고 : 여기 내가 할 노력하고있어입니다 ComboBox1의 항목이 선택되었습니다.
내 문제는 SelectedIndex를 얻으려고 할 때입니다.
SelectedIndex를 확인한 후 ComboBox1.Text를 사용하면 ComboBox2가 반응하지 않도록 null이 반환됩니다.
이벤트를 강제 실행하기 위해 버튼을 배치하려고 시도했지만 제대로 작동하지 않았습니다. 포커스를 해제 할 때까지 SelectedIndex 변경되지 않는 것 같습니다. 바인딩 예전처럼
<ComboBox Height="23" HorizontalAlignment="Left" Margin="166,12,0,0" Name="cbox_year" VerticalAlignment="Top" Width="120" SelectionChanged="cbox_year_SelectionChanged">
<ComboBoxItem Content="1st Year/1st Sem" />
<ComboBoxItem Content="1st Year/2nd Sem" />
<ComboBoxItem Content="2nd Year/1st Sem" />
<ComboBoxItem Content="2nd Year/2nd Sem" />
<ComboBoxItem Content="3rd Year/1st Sem" />
<ComboBoxItem Content="3rd Year/2nd Sem" />
<ComboBoxItem Content="4th Year/1st Sem" />
<ComboBoxItem Content="4th Year/2nd Sem" />
</ComboBox>
<ComboBox Height="23" HorizontalAlignment="Left" Margin="166,41,0,0" Name="cb_subj" VerticalAlignment="Top" Width="120" SelectionChanged="cb_subj_SelectionChanged" />
관련 XAML을 게시 할 수 있습니까? 또한, 귀하의 코드 부분은 어떤 이벤트 처리기입니까? –
상자의 SelectionChanged 이벤트의 일부입니다 – Nath