private View UpdateAttributesUI(ComosWebSDK.UI.UIOptions ui) { StackLayout stack = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, }; AbsoluteLayout.SetLayoutBounds(stack, new Rectangle( ui.x, ui.y, ui.width, ui.height)); stack.Children.Add(new Label() { Text = ui.Text, WidthRequest = ui.WidthLabel / (App.PixelDensity * 0.8), HorizontalTextAlignment = TextAlignment.End, VerticalTextAlignment = TextAlignment.Center, }); Picker p = new Picker() { HorizontalOptions = LayoutOptions.FillAndExpand, IsEnabled = !ui.ReadOnly, }; foreach (var c in ui.Options.Keys) { p.Items.Add(c); } p.SelectedItem = ui.Value; p.SelectedIndexChanged += PickerSelectionChanged; stack.Children.Add(p); return(stack); }
private void PickerSelectionChanged(object sender, EventArgs e) { Picker ctrl = (Picker)sender; ComosWebSDK.UI.UIOptions b = (ComosWebSDK.UI.UIOptions)ctrl.BindingContext; IBRServiceContracts.CWriteValue value = null; if (!Values.TryGetValue(b.NestedName, out value)) { value = new IBRServiceContracts.CWriteValue() { NestedName = b.NestedName, NewValue = b.Options[ctrl.SelectedItem.ToString()], OldValue = b.Value, WebSystemUID = this.SystemUID, }; Values.Add(b.NestedName, value); } else { value.NewValue = b.Options[ctrl.SelectedItem.ToString()]; } }