You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I came across this feature in CharacterMap UWP app, go to settings >> Look & Feel >> Design Style(at the bottom of the page)
And I think about it, it might not requires app restart and I think of a way to do it in runtime.
I can make a GlobalStyleSelector that defines a static instance, and emits property change event when the style changes. And any control that can change style can x:Bind its Style property to it.
The syntax would look like this
<Buttonx:Name="myButton"Click="myButton_Click"Style="{x:Bind local:GlobalStyleSelector.GetStyle(local:GlobalStyleSelector.Instance.CurrentStyle.Value, 'MyButtonStyle'), TargetNullValue={StaticResource DefaultButtonStyle}, Mode=OneWay}">
Click Me
</Button>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Recently I came across this feature in CharacterMap UWP app, go to settings >> Look & Feel >> Design Style(at the bottom of the page)
And I think about it, it might not requires app restart and I think of a way to do it in runtime.
I can make a
GlobalStyleSelector
that defines astatic
instance, and emits property change event when the style changes. And any control that can change style canx:Bind
itsStyle
property to it.The syntax would look like this
You can look at my demo project for details.
It's a bit too verbose to write. Please share you thought or maybe some better ideas?
Beta Was this translation helpful? Give feedback.
All reactions