Unplanned
Last Updated: 01 Jul 2025 21:09 by Heiko
Heiko
Created on: 01 Jul 2025 21:09
Category: UI for WinUI
Type: Bug Report
1
Common: User cannot override and use sucessfully Dark/Light/HighContrastResourcesPaths

Since Q2 2025, user defined Dark/Light/HighContrastResourcesPaths do not work - the custom resources are anot applied to the controls.

/// <summary>
/// Resource loader that provides the resource dictionaries with the brushes for the Telerik controls.
/// See https://docs.telerik.com/devtools/universal-windows-platform/common/teleriknamedbrushes.
/// </summary>
public sealed class TelerikResourceLoader : CustomXamlResourceLoader
{
    /// <inheritdoc/>
    protected override object GetResource(string resourceId, string objectType, string propertyName, string propertyType)
    {
        object result;
        if (resourceId == "DarkResourcesPath")
        {
            result = new Uri("ms-appx:///{ProjectName}/Assets/Themes/Dark_Telerik.xaml");
        }
        else if (
            resourceId == "LightResourcesPath" ||
            resourceId == "HighContrastResourcesPath")
        {
            result = new Uri("ms-appx:///{ProjectName}/Assets/Themes/Light_Telerik.xaml");
        }
        else
        {
            result = null;
        }
        return result;
    }
}

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Light">
        <SolidColorBrush x:Key="TelerikGrid_BackgroundPointerOver" Color="Red" Opacity="0.25"/>
    </ResourceDictionary>
    <ResourceDictionary x:Key="Dark">
        <SolidColorBrush x:Key="TelerikGrid_BackgroundPointerOver" Color="Green" Opacity="0.25"/>
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

CustomXamlResourceLoader.Current = new TelerikResourceLoader();

Edit - indeed the Light/Dark/ResourcePaths are deleted from the generic files of telerk controls due to the following regression in WinUI App SDK 1.7.25:
https://github.com/microsoft/microsoft-ui-xaml/issues/10506 

0 comments