【发布时间】:2016-04-28 21:33:51
【问题描述】:
假设我有一个极其简化的 xaml,如下所示:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="converter" />
<Style TargetType="FrameworkElement" x:Key="maybeCollapsed">
<Setter Property="Visibility" Value="{Binding Collapsed, Converter={StaticResource converter}}" />
</Style>
</UserControl.Resources>
<StackPanel>
<Label FontWeight="Bold" Content="Header" x:Name="Header" />
<TextBox Text="Name" Style="{StaticResource maybeCollapsed}" />
<TextBox Text="{Binding Name1}" Style="{StaticResource maybeCollapsed}"/>
</StackPanel>
</UserControl>
如何将第二种样式应用于所有使用maybeCollapsed 样式的元素,将IsTabStop 设置为False?我不能在样式本身中这样做,因为IsTabStop 不是FrameworkElements 的成员。
【问题讨论】:
标签: wpf xaml targettype