0
ComboBox
이있는 wpf 프로젝트가 있습니다. 내부의 항목은 동적으로 채워집니다. 그래서 그것은 Label
과 명령을 포함하는 모델에 묶여있다.WPF의 ComboBoxItem에 대한 바인딩 명령
사용자가 드롭 다운/ComboBox
에서 항목을 선택하면 명령이 실행되어야합니다. 명령에 TextBlock
및 Hyperlink
이 포함 된 DataTemplate
으로 시도했습니다. 그러나 Command는 Label
(Hyperlink
)을 선택하고 전체 항목을 클릭하는 경우에만 실행됩니다.
<ComboBox ItemsSource="{Binding Path=States}" SelectedItem="{Binding CurrentState}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<Hyperlink Command="{Binding Command}" TextDecorations="None" Foreground="Black">
<TextBlock Text="{Binding Path=Label}"/>
</Hyperlink>
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
그래서 질문은 지금, 어떻게 ComboBoxItem
내 명령을 결합 할 수있다?
고맙습니다! –