Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
VisualStateProperties.cs
1using System;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
8{
9
13 public static class VisualStateProperties
14 {
15 public static readonly BindableProperty StateProperty =
16 BindableProperty.CreateAttached(
17 "State",
18 typeof(object),
20 default,
21 propertyChanged: OnStateChanged);
22
23 public static object GetState(BindableObject view)
24 => view.GetValue(StateProperty);
25
26 public static void SetState(BindableObject view, object? value)
27 => view.SetValue(StateProperty, value);
28
29 static void OnStateChanged(BindableObject bindable, object? oldValue, object? newValue)
30 {
31 if (bindable is VisualElement Element && newValue is not null)
32 {
33 VisualStateManager.GoToState(Element, newValue.ToString());
34 }
35 }
36 }
37}
Creates Attached property in order to set the state of a VisualElement base on a binded string or enu...