【发布时间】:2017-06-23 08:11:28
【问题描述】:
我在stackoverflow中看到了如下代码:
<UserControl x:Class="WpfApplication3.UserControl1"
x:Name="Uc1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<Style TargetType="Label">
<Setter Property="Foreground"
Value="{Binding Foreground, ElementName=Uc1, Mode=OneWay}"/>
</Style>
</UserControl.Resources>
<Grid>
<Label Content="Label 1"/>
<Label Content="Label 2"/>
</Grid>
</UserControl>
问题:我现在想知道是否可以针对我的 usercontrol.resources 中的特定标签进行样式设置。我的userControl里面有可能吗?如果是那怎么办?
【问题讨论】:
标签: c# wpf xaml user-controls