[英]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>
可以通过在属性中双击前景的值来对其进行编辑。(已附加图像链接。请检查)。 但是在重新安装Visual Studio之后,我无法双击并选择颜色。 我可以在具有相同安装方式的笔记本电脑上执行此操作。
尝试添加画笔资源并在您的value字段中使用它,请尝试以下代码:
<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>
而不是双击,请右键单击并选择“编辑资源”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.