Hello,
With the introduction of static events, the data binding engine has the capability to detect property value changes. This has made it possible to modify static resources in XAML.
To define or modify the theme brush or any other theme resource, you can use the following syntax:
<SolidColorBrush x:Key="{x:Static telerik:VisualStudio2019ResourceKey.AccentBrush}" />
In order to download all the brushes for a particular theme, please refer to our PaletteResourcesExtractor SDK example.
Regards,
Masha
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
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.