如何启用颜色选择器 c# wpf Visual Studio 2015
How to enable color picker c# wpf Visual Studio 2015
在 Visual Studio 2015 年,特别是在 wpf 应用程序中,在 windows.resoures
中创建样式时,如下所示:
<Window.Resources>
<Style x:Key="DetailTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Blue"/>
</Style>
</Window.Resources>
可以通过在属性中双击它来编辑前景的值。(已附上图片link。请检查)。但是重新安装后 Visual Studio 我不能双击和 select 颜色。我可以使用相同的安装在我的笔记本电脑上执行此操作。
尝试添加画笔资源并在您的值字段中使用它,试试这个代码:
<Window.Resources>
<SolidColorBrush x:Key="TestBrush" Color="Blue"/>
<Style x:Key="DetailTextStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{StaticResource TestBrush}"/>
</Style>
</Window.Resources>
不要双击,而是右键单击并选择 "Edit Resource"
在 Visual Studio 2015 年,特别是在 wpf 应用程序中,在 windows.resoures
中创建样式时,如下所示:
<Window.Resources>
<Style x:Key="DetailTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="Blue"/>
</Style>
</Window.Resources>
可以通过在属性中双击它来编辑前景的值。(已附上图片link。请检查)。但是重新安装后 Visual Studio 我不能双击和 select 颜色。我可以使用相同的安装在我的笔记本电脑上执行此操作。
尝试添加画笔资源并在您的值字段中使用它,试试这个代码:
<Window.Resources>
<SolidColorBrush x:Key="TestBrush" Color="Blue"/>
<Style x:Key="DetailTextStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{StaticResource TestBrush}"/>
</Style>
</Window.Resources>
不要双击,而是右键单击并选择 "Edit Resource"