Re: Custom theme (from Blend 2015) problem with rendering and colors in Noesis.
Posted: 28 Mar 2018, 15:42
Anyway, the resource dictionary structure you initially provided does fail in Blend.
When I run this example in Blend:
App.xaml
Buttons.xaml
MainWindow.xaml
It produces the following error:
I cannot reference resources defined directly in the App.Resources from a merged dictionary set in App.Resources.
So I think you should avoid any hack and follow the guidelines I explained before.
When I run this example in Blend:
App.xaml
Code: Select all
<Application x:Class="StaticResourceTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Buttons.xaml"/>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="RedBrush" Color="Red"/>
</ResourceDictionary>
</Application.Resources>
</Application>Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate x:Key="ButtonTemplate" TargetType="Button">
<Grid Background="{StaticResource RedBrush}"/>
</ControlTemplate>
</ResourceDictionary>Code: Select all
<Window x:Class="StaticResourceTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Template="{StaticResource ButtonTemplate}"/>
</Grid>
</Window>Code: Select all
Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception. Line number '5' and line position '10'So I think you should avoid any hack and follow the guidelines I explained before.