는 임이 새로운 그래서 아마 그 잘못 될 수있는 매우 간단한 일이 ...WPF 스타일 템플릿
나는 스타일있는 ResourceDictionary를 사용하려고하지만, 아무튼 일하지 마라. 이 디렉토리입니다 :
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<LinearGradientBrush x:Key ="DarkBackground" StartPoint ="0,0" EndPoint =" 1,1">
<GradientStop Offset="0" Color =" #FF333344"></GradientStop>
<GradientStop Offset="1" Color =" #FF666677"></GradientStop>
</LinearGradientBrush>
<LinearGradientBrush x:Key="StandardBackground" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
<GradientStop Color="#FFDDDDDD" Offset="0.5"/>
<GradientStop Color="#FFBBBBBB" Offset="1"/>
</LinearGradientBrush>
Application.xaml 그렇게 보이는
:
내 MainWindow를에서<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
내가 원하는 다음 MainWindow를에
<Application x:Class="MyApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="\src\GUI\MainWindow.xaml">
<Application.Resources>
<ResourceDictionary Source ="StyleTemplates.xaml"> </ResourceDictionary>
</Application.Resources>
</Application>
져야 할 엔트리 다음과 같이하십시오.
<TabItem Header="Project config" Background="{StaticResource StandardBackground}" Margin="-2,-2,2,0" IsEnabled="{Binding ToolPreference.ProjectLoaded}">
MainWindow.xaml 및 다른 모든 availabe 창에서 스타일을 정적 리 소스로 가져 오려면 다음해야 할 일이 있습니까? 내 MainWindow.xaml 내가 이것을하려고 할 때 이제 "StandardBackground"를 볼 수 있습니다에서
: 내가 추가
<TabItem Header="Project config" Background="{StaticResource x:StandardBackground}" Margin="-2,-2,2,0" IsEnabled="{Binding ToolPreference.ProjectLoaded}">
있는 "X :"나는 StandardBackground과 DarkBackground와 드롭 다운을 얻는다. "StandardBackground 확인할 수 없습니다 자원 : X"
을이 http://prntscr.com/5sdssx –
좋아 나는 시도했지만 그것의 아직 작동하지 않습니다 ... – Andreas
Tabitem 배경은 스타일을 편집하여 변경할 수 있습니다.이 http://prntscr.com/5se761을 참조하십시오. –