-
-
sfernandez
Site Admin
- Posts: 3364
- Joined:
Re: Custom theme (from Blend 2015) problem with rendering and colors in Noesis.
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.
Re: Custom theme (from Blend 2015) problem with rendering and colors in Noesis.
Hmm.. I tried this:
and without errors.
only with Noesis, not in Blend. I have in Blend this structure: (it is created automaticly, by Blend)Anyway, the resource dictionary structure you initially provided does fail in Blend.
When I run this example in Blend:
App.xamlCode: 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
<Application x:Class="Zalohovaci_Program_GUI_2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Zalohovaci_Program_GUI_2"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="DarkFlatTheme.xaml"/>
<ResourceDictionary Source="main_buttons_stat_stop.xaml"/>
<ResourceDictionary Source="main_checkboxes_buttons.xaml"/>
<ResourceDictionary Source="main_radiobuttons.xaml"/>
<!-- And lot of others ResourceDictionary Source="xxx" -->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>Finally I did it and it working as I wishI 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.
Thanks, it helped me. I read all xaml files from Theme directory and add it in to appResources. Now all missing mouseover graphics is displayed.The code I was talking about should look like this:Code: Select all// Noesis::GUI::Init() ... // Noesis::GUI::SetXamlProvider/SetFontProvider/SetTextureProvider... Ptr<Noesis::ResourceDictionary> appResources = *new ResourceDictionary(); Noesis::GUI::SetApplicationResources(appResources); Ptr<Noesis::ResourceDictionary> commonResources = Noesis::GUI::LoadXaml<Noesis::ResourceDictionary>( "Themes/DarkFlat/DarkFlatTheme.xaml"); appResources->GetMergedDictionaries()->Add(commonResources); Ptr<Noesis::ResourceDictionary> otherResources = Noesis::GUI::LoadXaml<Noesis::ResourceDictionary>( "Themes/DarkFlat/others.xaml"); appResources->GetMergedDictionaries()->Add(otherResources);
Re: Custom theme (from Blend 2015) problem with rendering and colors in Noesis.
And one thing I must write. The DarkFlatTheme which contain all colors, must be loaded first, if not, then all xaml files which are loaded before DarkFlatTheme.xaml will have missing graphics for StaticResources.
Re: Custom theme (from Blend 2015) problem with rendering and colors in Noesis.
Remember what Sergio said. You don't need that code at all. Just having everything as you have in Blend (but instead of inside App.xaml using SetApplicationResources) should work with Noesis. If it doesn't there is a bug.Thanks, it helped me. I read all xaml files from Theme directory and add it in to appResources. Now all missing mouseover graphics is displayed.The code I was talking about should look like this:Code: Select all// Noesis::GUI::Init() ... // Noesis::GUI::SetXamlProvider/SetFontProvider/SetTextureProvider... Ptr<Noesis::ResourceDictionary> appResources = *new ResourceDictionary(); Noesis::GUI::SetApplicationResources(appResources); Ptr<Noesis::ResourceDictionary> commonResources = Noesis::GUI::LoadXaml<Noesis::ResourceDictionary>( "Themes/DarkFlat/DarkFlatTheme.xaml"); appResources->GetMergedDictionaries()->Add(commonResources); Ptr<Noesis::ResourceDictionary> otherResources = Noesis::GUI::LoadXaml<Noesis::ResourceDictionary>( "Themes/DarkFlat/others.xaml"); appResources->GetMergedDictionaries()->Add(otherResources);
Re: Custom theme (from Blend 2015) problem with rendering and colors in Noesis.
Then there is bug. Because I tried it load one xaml file with mergedDictionaries first, and without succes (under console wrote it is loaded, but buttons under mouse show black colors). I add it in bugtracker and upload file.
Who is online
Users browsing this forum: No registered users and 3 guests