मेरे पास एक संसाधन डिक्शनरी है जिसमें मेरे एप्लिकेशन के उपयोग में नियंत्रण के लिए स्टाइल परिभाषाएं हैं।WPF विंडो शैली लागू नहीं की जा रही है
सभी शैलियों को विंडो में नियंत्रण के लिए ठीक से लागू किया जाता है ... लेकिन विंडो के लिए संसाधन डिक्शनरी में शैली लागू नहीं की जा रही है।
यह मेरा ResourceDictionary में XAML कि शैली है कि मैं अपनी खिड़की पर लागू करना चाहते होता है:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:primatives="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type Window}">
<Setter Property="Background" Value="#FF121212"></Setter>
<Setter Property="Height" Value="768"></Setter>
<Setter Property="Width" Value="1024"></Setter>
</Style>
<!-- .... -->
</ResourceDictionary>
इस विंडो है कि मैं (इस शैली प्राप्त करने की कोशिश के साथ काम कर रहा हूँ के लिए XAML है लागू):
<Window x:Class="TryingStyles"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TryingStyles">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/StylesDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Label" Height="28" HorizontalAlignment="Left" Margin="12,12,0,0" Name="Label1" VerticalAlignment="Top" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="56,14,0,0" Name="TextBox1" VerticalAlignment="Top" Width="120" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TabControl Height="206" HorizontalAlignment="Left" Margin="12,43,0,0" Name="TabControl1" VerticalAlignment="Top" Width="250">
<TabItem Header="TabItem1" Name="TabItem1">
<Grid></Grid>
</TabItem>
</TabControl>
<GroupBox Header="GroupBox1" Margin="268,43,12,12" Width="396"></GroupBox>
</StackPanel>
</StackPanel>
</Window>
ऐसा लगता है कि जब मैं आईडीई के "डिज़ाइन दृश्य" लेकिन जब मैं अनुप्रयोग चलाने शैली लागू नहीं किया जाता में विंडो देखने खिड़की के लिए शैली लागू किया जाता है।
क्या कोई जानता है कि मैं क्या गलत कर रहा हूं?
आपकी मदद निकोलस के लिए बहुत बहुत धन्यवाद :) – Frinavale
आपको यह समाधान भी देखना चाहिए: http://stackoverflow.com/questions/431940/how-to-set-default-wpf-window-style-in-app-xaml –