2016-08-13 44 views
0

在Visual Studio 2015年,特別是在WPF應用程序,在windows.resoures創建一個風格時這樣的:如何使顏色選擇器C#WPF的Visual Studio 2015年

<Window.Resources> 
     <Style x:Key="DetailTextStyle" TargetType="TextBlock"> 
      <Setter Property="Foreground" Value="Blue"/> 
     </Style> 
</Window.Resources> 

前景的值可以通過雙擊編輯在屬性中點擊它(圖像鏈接已經被附加,plz檢查)。但重新安裝Visual Studio後,我無法雙擊並選擇顏色。我可以在我的筆記本電腦上安裝相同的設備。

See image showing the value from properties.

回答

0

嘗試添加畫筆資源,並在值字段使用它,試試這個代碼:

<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> 

代替雙擊做單擊右鍵並選擇「編輯資源」

+0

做過某事。仍然沒有工作。 – Quest