Label.SetAppThemeColor(Label.TextColorProperty, Colors.Green, Colors.Red) The SetAppThemeColor method enables Color objects to be specified that will be set on a target property based on the current system theme: Label label = new Label() NET MAUI includes SetAppThemeColor and SetAppTheme extension methods that enable VisualElement objects to respond to system theme changes. In this example, the background color of the Grid and the Button style changes based on whether the device is using its light theme or dark theme. In addition, resources defined in a ResourceDictionary can be consumed with the StaticResource markup extension: Similarly, the Image displays a different image file based upon the current system theme. In this example, the text color of the first Label is set to green when the device is using its light theme, and is set to red when the device is using its dark theme. The following XAML example shows how to use the AppThemeBinding markup extension: Therefore, for XAML markup expressions expressed with curly braces, you can eliminate the Default= part of the expression provided that it's the first argument. The Default property is the content property of AppThemeBindingExtension. The XAML parser allows the AppThemeBindingExtension class to be abbreviated as AppBindingTheme.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |