Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CompositePicker.cs
5using System.ComponentModel;
6
8{
10 {
11 #region Bindable Properties
15 public static readonly BindableProperty FontProperty =
16 BindableProperty.Create(nameof(Font), typeof(Microsoft.Maui.Font), typeof(CompositePicker), new Microsoft.Maui.Font());
17
21 public Microsoft.Maui.Font Font
22 {
23 get { return (Microsoft.Maui.Font)this.GetValue(FontProperty); }
24 set { this.SetValue(FontProperty, value); }
25 }
26
30 public static readonly BindableProperty XAlignProperty =
31 BindableProperty.Create(nameof(XAlign), typeof(TextAlignment), typeof(CompositePicker),
32 TextAlignment.Start);
33
37 public TextAlignment XAlign
38 {
39 get { return (TextAlignment)this.GetValue(XAlignProperty); }
40 set { this.SetValue(XAlignProperty, value); }
41 }
42
46 public static readonly BindableProperty HasBorderProperty =
47 BindableProperty.Create(nameof(HasBorder), typeof(bool), typeof(CompositePicker), true);
48
52 public bool HasBorder
53 {
54 get { return (bool)this.GetValue(HasBorderProperty); }
55 set { this.SetValue(HasBorderProperty, value); }
56 }
57
61 public static readonly BindableProperty PlaceholderProperty =
62 BindableProperty.Create(nameof(Placeholder), typeof(string), typeof(CompositePicker), string.Empty, BindingMode.OneWay);
63
67 public string Placeholder
68 {
69 get { return (string)this.GetValue(PlaceholderProperty); }
70 set { this.SetValue(PlaceholderProperty, value); }
71 }
72
76 public static readonly BindableProperty PlaceholderTextColorProperty =
77 BindableProperty.Create(nameof(PlaceholderTextColor), typeof(Color), typeof(CompositePicker), Colors.Transparent);
78
83 {
84 get { return (Color)this.GetValue(PlaceholderTextColorProperty); }
85 set { this.SetValue(PlaceholderTextColorProperty, value); }
86 }
87
91 public static readonly BindableProperty TextColorProperty =
92 BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(CompositePicker), Colors.Black);
93
97 public Color TextColor
98 {
99 get => (Color)this.GetValue(TextColorProperty);
100 set => this.SetValue(TextColorProperty, value);
101 }
102
106 public static readonly BindableProperty PickerStyleProperty =
107 BindableProperty.Create(nameof(PickerStyle), typeof(Style), typeof(CompositePicker), null);
108
109 public Style PickerStyle
110 {
111 get => (Style)this.GetValue(PickerStyleProperty);
112 set => this.SetValue(PickerStyleProperty, value);
113 }
114
115 public static readonly BindableProperty ItemsSourceProperty =
116 BindableProperty.Create(nameof(ItemsSource), typeof(IList), typeof(CompositePicker), null);
117
118 public IList ItemsSource
119 {
120 get => (IList)this.GetValue(ItemsSourceProperty);
121 set => this.SetValue(ItemsSourceProperty, value);
122 }
123
124 public static readonly BindableProperty SelectedItemProperty =
125 BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(CompositePicker), null, BindingMode.TwoWay);
126
127 public object SelectedItem
128 {
129 get => (object)this.GetValue(SelectedItemProperty);
130 set => this.SetValue(SelectedItemProperty, value);
131 }
132
133 public BindingBase ItemDisplayBinding
134 {
135 get => this.picker.ItemDisplayBinding;
136 set => this.picker.ItemDisplayBinding = value;
137 }
138
139 #endregion
140
141 #region Fields
142
143 private readonly Picker picker;
144
145 public Picker Picker
146 {
147 get => this.picker;
148 }
149
150 #endregion
151
152 public CompositePicker()
153 {
154 this.picker = new Picker();
155
156 this.picker.SetBinding(Picker.TitleProperty, new Binding(nameof(this.Placeholder), source: this));
157 this.picker.SetBinding(Picker.TextColorProperty, new Binding(nameof(this.TextColor), source: this));
158 //this.picker.SetBinding(Picker.FontProperty, new Binding(nameof(this.Font), source: this));
159 this.picker.SetBinding(Picker.HorizontalTextAlignmentProperty, new Binding(nameof(this.XAlign), source: this));
160 this.picker.SetBinding(Picker.StyleProperty, new Binding(nameof(this.PickerStyle), source: this));
161 this.picker.SetBinding(Picker.SelectedItemProperty, new Binding(nameof(this.SelectedItem), source: this, mode: BindingMode.TwoWay));
162 this.picker.SetBinding(Picker.ItemsSourceProperty, new Binding(nameof(this.ItemsSource), source: this));
163
164 this.CenterView = this.picker;
165 }
166 }
167}
static readonly BindableProperty TextColorProperty
The TextColor property
static readonly BindableProperty HasBorderProperty
The HasBorder property
static readonly BindableProperty PlaceholderTextColorProperty
The PlaceholderTextColor property
bool HasBorder
Gets or sets if the border should be shown or not
string Placeholder
Get or sets the PlaceHolder
TextAlignment XAlign
Gets or sets the X alignment of the text
static readonly BindableProperty FontProperty
The font property
static readonly BindableProperty PlaceholderProperty
The Placeholder property
static readonly BindableProperty PickerStyleProperty
Bindable property for the style applied to the picker
Color TextColor
Gets or sets the TextColor
Microsoft.Maui.Font Font
Gets or sets the Font
static readonly BindableProperty XAlignProperty
The XAlign property
Color PlaceholderTextColor
Sets color for placeholder text