Global Style and local style
Hi, on my application I have created a GlobalStyle, I also had for some specific screen a local style that I put at the start of the specific screen:
I initially was recally the globalstyle as a merge dictionnary here and on the style file, but it made the loading of the screen way too long, so I am currently trying to delete of my ResourceDictionary GlobalStyle, only calling it on Unity and App.xaml.
It worked for all screen which did not had a local style but not for some of the screens with a local style (it work on unity but not on blend). It gives me this error:
I would love some indications on how to fix the problem without recalling the globalstyle everywhere !
Code: Select all
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/PlayerOverviewStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
It worked for all screen which did not had a local style but not for some of the screens with a local style (it work on unity but not on blend). It gives me this error:
(LightGrayBrush is of course define in my GlobalStyle)System.Windows.Markup.XamlParseException
HResult=0x80131501
Message='The value provided on 'System.Windows.Markup.StaticResourceHolder' threw an exception. ' line number '267' and line position '18'.
Source=PresentationFramework
Inner Exception 1:
Exception: Cannot find the resource named 'LightGrayBrush'. Resource names are case sensitive.
I would love some indications on how to fix the problem without recalling the globalstyle everywhere !
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Global Style and local style
In Blend global style should be set in the App.xaml, which equals to setting it in Unity on Noesis Settings property "Application Resources".
Resources defined there can be referenced as StaticResource by any other xaml in the project.
If that configuration is what you have there must be something I am missing, could you share a minimal Blend project that reproduces the problem?
Resources defined there can be referenced as StaticResource by any other xaml in the project.
If that configuration is what you have there must be something I am missing, could you share a minimal Blend project that reproduces the problem?
Re: Global Style and local style
I did not success to isolate it, but my programmer could, and the way we fix the problem so it also worked on Blend was to call 2 times our global style in App.xaml:
Code: Select all
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="TMPC/Assets/WPF/Styles/GlobalStyle.xaml"/>
<ResourceDictionary Source="TMPC/Assets/WPF/Styles/GlobalStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: Global Style and local style
It is really weird you need to do that, it has no sense. Could you please create a private ticket in our bugtracker and share the Blend project with us, we will take a look and try to find the source of the problem.
Who is online
Users browsing this forum: No registered users and 12 guests