콤보의 특정 항목을 선택한 경우에만 레이블을 표시하려고합니다. 코드가이를 설명해야합니다.WPF 콤보 선택을 기반으로 한 UI 요소의 가시성
<ComboBox Name="comboMyCombo">
<ComboBoxItem>Don't show the label</ComboBoxItem>
<ComboBoxItem>Show the label</ComboBoxItem>
</ComboBox>
<Label Visibility="Collapsed">This is my label
<Label.Style>
<Style>
<Style.Triggers>
<DataTrigger
Binding="{Binding ElementName=comboMyCombo, Path=SelectedValue}" Value="Show the label">
<Setter Property="Label.Visibility" Value="Visible"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
것입니까? 이 선택 영역을 기반으로 숨기고 싶은 여러 컨트롤이 있습니다. 그들은 별도의 그리드 셀이므로 전체 스택 패널을 숨길 수는 없습니다. – tim
여러 컨트롤 유형 (Label, Button 등)에 걸쳐 의미가있는 경우 첨부 된 동작으로이를 수행합니다. 동일한 컨트롤 유형의 서로 다른 인스턴스간에 재사용을 의미하는 경우 스타일을 리소스로 설정해야합니다. –
연결된 동작입니다. Scott, 고맙습니다. – tim