Skip to content

Add API to force reapplication of VisualStateManager groups #34722

@StephaneDelcroix

Description

@StephaneDelcroix

Description

Similar to #34721 (Style reapplication), when VisualStateGroup setters are mutated in-place (e.g., a VisualState's Setter Value is changed), the framework does not reapply the visual state to the target element.

VisualStateGroupList validates group/state name uniqueness on Add() via WatchAddList, but there is no mechanism to re-evaluate and reapply the current visual state after setter mutations.

Motivation

Hot Reload scenarios (including XAML Incremental Hot Reload) need to update VSM setters in-place and have the changes reflected on the element. Currently there is no way to force reapplication of the current visual state without reconstructing the entire VisualStateGroup hierarchy.

Proposed API

// Force re-evaluation and reapplication of the current visual state
VisualStateManager.InvalidateVisualStates(VisualElement element);

Or an internal API if this should not be public.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    s/triagedIssue has been reviewed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions