我有下一个 XAML 代码:
<Grid>
<Grid.Resources>
<ResourceDictionary Source="Styles.xaml"/>
</Grid.Resources>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Style="{StaticResource UserIcon}"/>
<Path Style="{StaticResource UserIcon}"/>
</StackPanel>
</Grid>
Styles.xaml 中的样式:
<Style x:Key="UserIcon"
TargetType="Path">
<Style.Setters>
<Setter Property="Data" Value="M0 58l0 13 70 0 0 -12c-39,-33 -70,-1 -70,-1zm53 -40c0,-10 -8,-18 -18,-18 -9,0 -17,8 -17,18 0,9 8,17 17,17 10,0 18,-8 18,-17z" />
<Setter Property="Fill" Value="Black"/>
</Style.Setters>
</Style>
问题:样式只使用了一次。第二个路径控件没有来自样式的数据,并且在设计器(以及执行)中看起来像这样。
忽然笑
相关分类