Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SetFocusOnCompletedBehavior.cs
1using System.ComponentModel;
3
5{
9 public class SetFocusOnCompletedBehavior : Behavior<CompositeEntry>
10 {
14 [TypeConverter(typeof(ReferenceTypeConverter))]
15 public View? SetFocusTo { get; set; }
16
20 [TypeConverter(typeof(ReferenceTypeConverter))]
21 public View? SetFocusToAlternative { get; set; }
22
26 public static readonly BindableProperty UseAlternativeProperty =
27 BindableProperty.Create(nameof(UseAlternative), typeof(bool), typeof(SetFocusOnCompletedBehavior), default);
28
32 public bool UseAlternative
33 {
34 get => (bool)this.GetValue(UseAlternativeProperty);
35 set => this.SetValue(UseAlternativeProperty, value);
36 }
37
39 protected override void OnAttachedTo(CompositeEntry entry)
40 {
41 entry.Completed += this.Entry_Completed;
42 base.OnAttachedTo(entry);
43 }
44
46 protected override void OnDetachingFrom(CompositeEntry entry)
47 {
48 entry.Completed -= this.Entry_Completed;
49 base.OnDetachingFrom(entry);
50 }
51
52 private void Entry_Completed(object? Sender, EventArgs e)
53 {
54 if (this.UseAlternative && this.SetFocusToAlternative is not null)
56 else
58 }
59 }
60}
Used for moving focus to the next UI component when a button has been clicked.
static void FocusOn(View Element)
Sets focus on an element.
Used for moving focus to the next UI component when the Enter/Return key has been hit.
static readonly BindableProperty UseAlternativeProperty
Makes UseAlternative bindable.