Open kucint opened 3 weeks ago
The problem here is that the VisualStateManager
should only be set on the direct child of a templated control, as documentation says:
Conceptually, VisualStateManager.VisualStateGroups contains the visual states for a control, as an immediate child tag of the template root in a control template.
And this doc page says:
When you use
StateTriggers
, ensure that theVisualStateGroup
is declared under the first child of the root in order for the triggers to take effect automatically.
This limitation is based on WinUI and we cannot easily circumvent it. However, you can create custom controls that are nested and that will have their own VisualStateManager
on the root child
I got it: VisualStateManager
must be set on the direct child of a templated control.
But this is a case in "MyControl5" and the VisualStateManager
is lot working anyway....
@MartinZikmund , could you please reopen issue. I can't do it...
You are right, missed that one. It seems that it may be some C# markup issue.
Current behavior
I implemented
VisualStateManager
as presented in example: VisualStateManager In this example,VisualStateManager
is a property of a topmostUIElement
. It is working fine.I created couples of other scenarios where
VisualStateManager
is not working, don't know why.VisualStateManager
is a property of topmost element in the custom controlVisualStateManager
is a property of a child of aPanel
in the custom controlHave look on different scenarios bellow:
VisualStateManager
to the child?VisualStateManager
in custom Control?VisualStateManager
in custom Control?Expected behavior
VisualStateManager
should work in all scenarios, I guess, or I miss something...How to reproduce it (as minimally and precisely as possible)
MINIMAL REPRO PROJECT: VisualStateManagerApp.zip
STEPS TO REPRODUCE
Environment
Nuget Package (s):
Package Version(s):
"Uno.Sdk": "5.3.108"
Issue is observed on both frameworks
Desktop
andWindowsSdk
Affected platform(s):
Visual Studio:
Relevant plugins:
Anything else we need to know?