public override void EndInit() { base.EndInit(); ExtTextBlock block = new ExtTextBlock { Width = 100, Height = 20, Text = "Test Block" }; ExtButton button = new ExtButton { Width = 100, Height = 20, Content = "ClickMe" }; ExtLabel label = new ExtLabel { Width = 100, Height = 30, Content = "Test Label" }; ExtTextBox txtBox = new ExtTextBox { Width = 100, Height = 20, Text = "Hi There" }; Grid g = (Grid)BaseControl.FindChild(this, "gridMain"); g.Children.Add(button); g.Children.Add(block); g.Children.Add(label); g.Children.Add(txtBox); Grid.SetRow(block, 0); Grid.SetRow(button, 1); Grid.SetRow(label, 2); Grid.SetRow(txtBox, 3); button.Click += button_Click; }
public NoteView(NoteData noteData) { if (_defaultText == null) { _defaultText = Tr.Get("NoteView.Default"); } _note = new ExtLabel { Text = null, FontStyle = Theme.RowFont, ColorStyle = Theme.TextColor, Margin = new Thickness(0, 0, 0, 5), InputTransparent = true }; _footer = new ExtLabel { Text = null, FontStyle = Theme.DetailFont, ColorStyle = Theme.TextColor, InputTransparent = true }; InputTransparent = true; Spacing = 0; SizeChanged += ViewSizeChanged; Children.Add(_note); Children.Add(_footer); Update(noteData); }
protected override void OnPropertyChanged(string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName == StepsProperty.PropertyName) { for (int i = 0; i < Steps * 2; i = i + 2) { var label = new ExtLabel() { Text = "A" , ClassId = $"{i + 1}" , Style = Application.Current.Resources["RangeLabel"] as Style }; try { Children.Add(label, i, 0); } catch (Exception exception) { Crashes.TrackError(exception); } var button = new Button() { ClassId = $"{i + 1}", VerticalOptions = LayoutOptions.Center, Style = Application.Current.Resources["DotButtonStyle"] as Style }; button.Clicked += Handle_Clicked; Children.Add(button, i, 1); if (i < Steps * 2 - 2) { var separatorLine = new StackLayout() { BackgroundColor = Color.Black, HeightRequest = 2, WidthRequest = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; try { Children.Add(separatorLine, i + 1, 1); } catch (Exception exception) { Crashes.TrackError(exception); } } } } else if (propertyName == StepSelectedProperty.PropertyName) { var children = Children.First(p => (!string.IsNullOrEmpty(p.ClassId) && Convert.ToInt32(p.ClassId) == StepSelected)); if (children != null) { SelectElement(children as Button); } } else if (propertyName == StepColorProperty.PropertyName) { AddStyles(); } }