TintedResourceDictionary not accessible after upgrade

Docking/MDI for WPF Forum

Posted 9 years ago by Alexandre De Riemaecker
Version: 10.2.0530
Avatar
I need to access a TintedResourceDictionary via XAML.
To be frank, I had a working solution until the last update, but I didn't grasp why it even worked at all.
I used ThemeManager.SetTheme(nestedDockSite, m_ThemeName) and could access the tinted Brushes from anywhere inside the Page Control where the nestedDockSite is in. From my understanding, that shouldn't even be possible, as the TintedResourceDictionary is merged in the resources of the DockSite, so neighboring elements shouldn't be able to get access it.

However, it did what I wanted, which is not the case anymore. My last try was to merge the TintedDictionary directly in the parent container. This works for the DockSite, but other child elements besides the DockSite still accesses the resources from the current theme.

This sample XAML clarifies what I want to (re)accomplish:

<Page x:Name="Page">
  <StackPanel>
    <docking:DockSite x:Name="NestedDockSite"/>
    <Rectangle Fill={DynamicResource {x:Static themes:DockingCommonDictionary.ToolWindowContainerTitleBarBackgroundInactiveBrushKey}}/>
  </StackPanel>
<Page>
And this is my last try ( commented lines are from the previous, working version)

if (!ThemeManager.IsThemeRegistered(m_ThemeName) 
    && !string.IsNullOrEmpty(ThemeManager.CurrentTheme) 
    && !string.IsNullOrEmpty(DockingCommonDictionary.GroupName))
{
    ResourceDictionary _dockingResourceDictionary = ThemeManager.GetResourceDictionary(ThemeManager.CurrentTheme, DockingCommonDictionary.GroupName);
    TintedResourceDictionary _tintedDictionary = new TintedResourceDictionary(_dockingResourceDictionary, this.TabTintColor);
                    
    //ThemeManager.Register(m_ThemeName, DockingCommonDictionary.GroupName, _tintedDictionary);
    this.Frame.LoadCompleted += new LoadCompletedEventHandler((object sender, NavigationEventArgs e) =>
    {
        //ThemeManager.SetTheme((DependencyObject)this.Page.NestedDockSite, m_ThemeName);
        this.Page.Resources.MergedDictionaries.Add(_tintedDictionary);
    });
}
I thought this must be foolproof, but in this case, the resources are still taken from the current theme (besides the DockSite).

Comments (2)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alexandre,

We tried to send you an email separately, but have not heard back. We'd recommend you test this with the latest maintenance release (WPF Studio 2010.2 build 0531). If that doesn't help then please put together a small sample project and email it over to our support address, so we can take a closer look.


Actipro Software Support

Posted 9 years ago by Alexandre De Riemaecker
Avatar
Thank you. I'll try the maintenance release and tell you if that resolved the issue in my specific case.
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.