Obtaining VisualStyleGroup from a Style #17322
Replies: 3 comments 2 replies
-
In Uno, for performance reasons, visual state groups are not materialized eagerly for performance reasons. Why do you need to access the states this way? |
Beta Was this translation helpful? Give feedback.
-
Jerome Please clarify What does "visual state groups are not materialized eagerly for performance reasons' mean? Not eagerly == lazy? Is there some way that I could invoke the lazy access. I added a new class derived from Button and declared my button which uses a style to be of that class. I then overrode the "On Apply Template" method. I had hoped that this method would be invoked after the visual state groups were materialized not eagerly. Unfortunately, GetVisualStateGroups still returns an empty IList How would I potentially use FindName? I tried naming the ControlTemplate and using FindName() but FindName returned null You never indicated whether the .baml file can be found in the .dll for my UnoProject |
Beta Was this translation helpful? Give feedback.
-
Jerome Here is code to read the VisualStateGroup for a Button with a Style containing a VisualStateGroup. myVisual is the button object obtaing using FindName
This resolved my problem |
Beta Was this translation helpful? Give feedback.
-
Linux, .Net 8.0, UNO 5+
I use a straightforward routine in C# to obtain style groups for a control
I find that vsg is [Ilist]: {Microsoft.UI.Xaml.VisualStateGroup[0]}. That is, no VisualState groups are returned even though the Style defines visit state groups
How should I obtain the VisualStateGroups for the styled button?
Beta Was this translation helpful? Give feedback.
All reactions