【发布时间】:2013-08-15 18:57:03
【问题描述】:
我从一个 TextBox 派生出来并将其命名为 MyTextBox。 在我的 LayoutAwarePage 上,我创建了 2 个 SolidColorBrush 道具:MyBackground 和 MyBorder。 在该页面的 Xaml 中,我为控件 MyTextBox 编写了一个带有样式的 ResourceDictionary:
<Grid.Resources>
<ResourceDictionary>
<Style TargetType="a:MyTextBox">
<Setter Property="Background" Value="{Binding MyBackground}"></Setter>
<Setter Property="BorderBrush" Value="{Binding MyBorder}"></Setter>
<Setter Property="Width" Value="200"></Setter>
<Setter Property="IsReadOnly" Value="False"></Setter>
<Setter Property="BorderBrush" Value="3"></Setter>
</Style>
</ResourceDictionary>
</Grid.Resources>
当我运行此页面时,我看不到控件。 我没有忘记为页面创建一个DataContext,并且属性是真彩色(不是黑色)。 知道如何解决这个问题吗?
【问题讨论】:
标签: xaml windows-8 windows-runtime windows-store-apps winrt-xaml