Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ButtonElement.cs
1using System.Windows.Input;
2
4{
5 internal static class ButtonElement
6 {
10 public static readonly BindableProperty CommandProperty = BindableProperty.Create(
11 nameof(IButtonElement.Command), typeof(ICommand), typeof(IButtonElement), null,
12 propertyChanging: CommandElement.OnCommandChanging, propertyChanged: CommandElement.OnCommandChanged);
13
17 public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create(
18 nameof(IButtonElement.CommandParameter), typeof(object), typeof(IButtonElement), null,
19 propertyChanged: CommandElement.OnCommandParameterChanged);
20
24 public const string PressedVisualState = "Pressed";
25
32 public static void ElementClicked(VisualElement VisualElement, IButtonElement ButtonElementManager)
33 {
34 if (VisualElement.IsEnabled == true)
35 {
36 ButtonElementManager.Command?.Execute(ButtonElementManager.CommandParameter);
37 ButtonElementManager.PropagateUpClicked();
38 }
39 }
40
42 /*
49 public static void ElementPressed(VisualElement visualElement, IButtonElement ButtonElementManager)
50 {
51 if (visualElement.IsEnabled == true)
52 {
53 ButtonElementManager.SetIsPressed(true);
54 visualElement.ChangeVisualStateInternal();
55 ButtonElementManager.PropagateUpPressed();
56 }
57 }
58
65 public static void ElementReleased(VisualElement visualElement, IButtonElement ButtonElementManager)
66 {
67 // Even if the button is disabled, we still want to remove the Pressed state;
68 // the button may have been disabled by the the pressing action
69 ButtonElementManager.SetIsPressed(false);
70 visualElement.ChangeVisualStateInternal();
71 ButtonElementManager.PropagateUpReleased();
72 }
73 */
74 }
75}