5using System.Threading.Tasks;
15 public static readonly BindableProperty StateProperty =
16 BindableProperty.CreateAttached(
21 propertyChanged: OnStateChanged);
23 public static object GetState(BindableObject view)
24 => view.GetValue(StateProperty);
26 public static void SetState(BindableObject view,
object? value)
27 => view.SetValue(StateProperty, value);
29 static void OnStateChanged(BindableObject bindable,
object? oldValue,
object? newValue)
31 if (bindable is VisualElement Element && newValue is not
null)
33 VisualStateManager.GoToState(Element, newValue.ToString());
Creates Attached property in order to set the state of a VisualElement base on a binded string or enu...