| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using InABox.Core;
- using InABox.Mobile;
- using Xamarin.Forms;
- namespace PRS.Mobile
- {
- public class DigitalFormLookupComboBox : DigitalFormLookupView
- {
- private readonly Grid _grid;
- private readonly MobileCard _labelframe;
- private readonly Label _label;
- private readonly MobileButton _button;
-
- protected override void UpdateUI()
- {
- _label.Text = String.IsNullOrWhiteSpace(_value.Text) ? "Select Value" : _value.Text;
- }
-
- public DigitalFormLookupComboBox()
- {
- HeightRequest = 40;
- _grid = new Grid();
-
- _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star });
- _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
-
- _grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star });
- _labelframe = new MobileCard()
- {
- Padding = 5
- };
- _grid.Children.Add(_labelframe);
-
- _label = new Label
- {
- Text = "Select Value",
- VerticalTextAlignment = TextAlignment.Center,
- FontSize = Device.GetNamedSize(NamedSize.Small,new Label()),
- LineBreakMode = LineBreakMode.TailTruncation,
- Margin = 5
- };
- _labelframe.Content = _label;
-
- _button = new MobileButton()
- {
- WidthRequest = 35,
- Image = ImageSource.FromFile("lines")
- };
- _button.Clicked += DoLookup;
- _button.SetValue(Grid.ColumnProperty,1);
- _grid.Children.Add(_button);
- Content = _grid;
- }
- protected override void UpdateStatus()
- {
- IsEnabled = !ReadOnly || Definition.Properties.Secure;
-
- var labelcolors = DigitalFormUtils.GetColors(!IsEnabled, Definition.Properties.Required, false);
- _labelframe.BackgroundColor = labelcolors.Background;
- _labelframe.BorderColor = labelcolors.Border;
- _label.TextColor = labelcolors.Foreground;
-
- var menucolors = DigitalFormUtils.GetColors(!IsEnabled, Definition.Properties.Required, true);
- _button.BackgroundColor = menucolors.Background;
- _button.BorderColor = menucolors.Border;
-
- }
-
- }
- }
|