BoJack
Topic Author
Posts: 11
Joined: 28 Apr 2020, 12:16

Global Style and local style

11 Aug 2020, 16:39

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:
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles/PlayerOverviewStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
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:
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.
(LightGrayBrush is of course define in my GlobalStyle)

I would love some indications on how to fix the problem without recalling the globalstyle everywhere !
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Global Style and local style

11 Aug 2020, 21:10

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?
 
BoJack
Topic Author
Posts: 11
Joined: 28 Apr 2020, 12:16

Re: Global Style and local style

17 Aug 2020, 09:29

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:
    <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>
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Global Style and local style

20 Aug 2020, 10:29

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 45 guests