Skip to main content

ThemeResourceExtension

C# API / Fluence.Wpf.Markup

  • Assembly: Fluence.Wpf
  • Namespace: Fluence.Wpf.Markup
public sealed class ThemeResourceExtension : DynamicResourceExtension

A theme-reactive resource reference equivalent to the WinUI 3 {ThemeResource} markup extension. Use it to reference a resource whose value must follow the active theme, such as any canonical Fluence color or brush token: {fluence:ThemeResource TextFillColorPrimaryBrush}.

Remarks: This extension derives from DynamicResourceExtension and shares its exact runtime behavior. Fluence republishes its computed color and brush dictionary on every theme or accent change, so any dynamic reference to a canonical token re-resolves automatically; this type exists so markup ported from WinUI 3 keeps its theme-versus-static intent readable. Unlike WinUI, WPF markup extensions always require an XML namespace prefix.

As with WinUI, a StaticResource reference to a theme-dependent value does not update when the theme changes; use this extension (or DynamicResource) for any value that must react to theme, accent, or high contrast at runtime.

Base type: DynamicResourceExtension (including inherited WPF and .NET members)

C# source

Constructors​

ThemeResourceExtension​

public ThemeResourceExtension()

Initializes a new instance of the ThemeResourceExtension class.

ThemeResourceExtension​

public ThemeResourceExtension(object resourceKey)

Initializes a new instance of the ThemeResourceExtension class with the given resource key.

Parameter resourceKey: The key of the resource to reference.