Quantcast
Channel: User Liyun Zhang - MSFT - Stack Overflow
Viewing all articles
Browse latest Browse all 444

Answer by Liyun Zhang - MSFT for How to define a MAUI global style for your own class?

$
0
0

You can declare the TextColor as bindable property add then set the style:

public class MyClass : Grid, IDisposable  {      private Label label;      public static readonly BindableProperty TextColorProperty =BindableProperty.Create("TextColor", typeof(Color), typeof(MyClass), Colors.Black);      public Color TextColor      {          get => (Color)GetValue(TextColorProperty);          set { SetValue(TextColorProperty, value); label.TextColor = value; }      }  }

For more information, you can read the official document about Bindable properties


Viewing all articles
Browse latest Browse all 444

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>