我想有一个StackPanel谁的知名度应该取决于组合框的选择。不幸的是下面的XAML不起作用。StackPanel的可视性取决于组合框选择
我发现,这将在组合框中选择的PropertyChanged事件来设置,但我宁愿这个严格的XAML解决方案的新属性的解决方案。
如何解决这个任何提示?
<StackPanel>
<Label>Picture in Picture function</Label>
<ComboBox Name="cbPictureInPicture" ItemsSource="{Binding Path=PictureInPictureCodeList, Mode=OneWay}" DisplayMemberPath="CodeText"
SelectedValuePath="CodeID" SelectedValue="{Binding Path=PictureInPicture, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel>
<StackPanel.Style>
<Style TargetType="StackPanel">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=cbPictureInPicture, Path=IsSelected.CodeText}" Value="Yes">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<Label>Picture in Picture is used</Label>
(...)
</StackPanel>
我用IsSelected代替的SelectedItem。感谢提示! – RobaL 2014-10-08 07:56:18
太棒了!快乐编码:) – pushpraj 2014-10-08 08:12:13