我正在执行UWP应用程序。我的一个UserControl具有一个依赖项属性,它是一个SolidColorBrush
。获取UWP应用程序中画笔的可能值之一
在WPF中,我下面的:
public static readonly DependencyProperty BackgroundColorProperty =
DependencyProperty.Register("BackgroundColor", typeof(SolidColorBrush), typeof(StarControl),
new FrameworkPropertyMetadata((SolidColorBrush)Brushes.Transparent,
new PropertyChangedCallback(OnBackgroundColorChanged)));
就目前而言,UWP,我下面的:
public static readonly DependencyProperty BackgroundColorProperty =
DependencyProperty.Register("BackgroundColor", typeof(SolidColorBrush), typeof(StarControl),new PropertyMetadata(/* ?????*/, OnBackgroundColorChanged));
的问题是,Brushes
并不似乎是可用,应该使用什么?
谢谢
您是通过XAML还是通过代码设置属性? –
@TomDroste问题是关于如何在代码 – J4N