Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TextButton.cs
2
4{
5 public class TextButton : TemplatedButton, IBorderDataElement, ILabelDataElement
6 {
7 private readonly Border innerBorder;
8 private readonly Label innerLabel;
9
11 public static readonly BindableProperty BorderStyleProperty = BorderDataElement.BorderStyleProperty;
12
14 public static readonly BindableProperty LabelDataProperty = LabelDataElement.LabelDataProperty;
15
17 public static readonly BindableProperty LabelStyleProperty = LabelDataElement.LabelStyleProperty;
18
19 public void OnBorderStylePropertyChanged(Style OldValue, Style NewValue)
20 {
21 this.innerBorder.Style = NewValue;
22 }
23
24 public void OnLabelDataPropertyChanged(string OldValue, string NewValue)
25 {
26 this.innerLabel.Text = NewValue;
27 }
28
29 public void OnLabelStylePropertyChanged(Style OldValue, Style NewValue)
30 {
31 this.innerLabel.Style = NewValue;
32 }
33
34 public static Thickness BorderPaddingDefaultValueCreator() => Thickness.Zero;
35
36 public Style BorderStyle
37 {
38 get => (Style)this.GetValue(BorderDataElement.BorderStyleProperty);
39 set => this.SetValue(BorderDataElement.BorderStyleProperty, value);
40 }
41
42 public string LabelData
43 {
44 get => (string)this.GetValue(LabelDataElement.LabelDataProperty);
45 set => this.SetValue(LabelDataElement.LabelDataProperty, value);
46 }
47
48 public Style LabelStyle
49 {
50 get => (Style)this.GetValue(LabelDataElement.LabelStyleProperty);
51 set => this.SetValue(LabelDataElement.LabelStyleProperty, value);
52 }
53
54 public TextButton()
55 : base()
56 {
57 this.innerLabel = new()
58 {
59 HorizontalOptions = LayoutOptions.Center,
60 };
61
62 this.innerBorder = new()
63 {
64 StrokeThickness = 1,
65 Content = this.innerLabel
66 };
67
68 this.Content = this.innerBorder;
69 }
70 }
71}
TemplatedButton represents a generalization of a Button whose appearance is defined by a ControlTempl...
static readonly BindableProperty BorderStyleProperty
Bindable property for BorderStyle.
Definition: TextButton.cs:11
static readonly BindableProperty LabelDataProperty
Bindable property for LabelData.
Definition: TextButton.cs:14
static readonly BindableProperty LabelStyleProperty
Bindable property for LabelStyle.
Definition: TextButton.cs:17