In my ResourceDictionary
I'm setting default style for TextBlock
:
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="Margin" Value="10" />
</Style>
Then when I put lets say a CheckBox
it looks fine in the designer but on runtime the TextBlock
inside the CheckBox
has that 10 margin
.
What can cause that to happen?...
I'm setting the resources inside App.xaml.cs
(Because I'm not using StartUri
):
_mainView.Resources.Source = new Uri("pack://application:,,,/App;component/Resources/DarkTheme.xaml"); // Colors and brushes
ResourceDictionary style = new ResourceDictionary
{
Source = new Uri("pack://application:,,,/App;component/Resources/Style.xaml")
};
_mainView.Resources.MergedDictionaries.Add(style); // Styles