Hello everyone,
Thank you for your feedback.
One possible approach is to create attached properties for the theme's palette colors and apply them to any chosen DependencyObject in your application, for example, the MainWindow.
<Window x:Class="ChangePaletteSettingsPerControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:ChangePaletteSettingsPerControl"
local:MaterialThemeExtensions.PrimaryNormalColor="Red"
local:MaterialThemeExtensions.PrimaryHoverColor="SteelBlue"
local:MaterialThemeExtensions.PrimaryFocusColor="Green"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
public class MaterialThemeExtensions
{
public static Color GetPrimaryNormalColor(DependencyObject obj)
{
return (Color)obj.GetValue(PrimaryNormalColorProperty);
}
public static void SetPrimaryNormalColor(DependencyObject obj, Color value)
{
obj.SetValue(PrimaryNormalColorProperty, value);
}
public static readonly DependencyProperty PrimaryNormalColorProperty =
DependencyProperty.RegisterAttached("PrimaryNormalColor", typeof(Color), typeof(MaterialThemeExtensions), new PropertyMetadata(OnPrimaryNormalColorPropertyChanged));
private static void OnPrimaryNormalColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
MaterialPalette.Palette.PrimaryNormalColor = (Color)e.NewValue;
}
// ...
Could you please give these approaches a try and let me know if any of them would work for you?
Regards,
Dilyan Traykov
Progress Telerik
absolutely necessary!
Indeed, for skinning purposes it would be better to have everything in XAML, including base fonts and colors.
It would be a plus to manage custom applications styles using noxaml binaries.