protected override void OnElementChanged(ElementChangedEventArgs <ImageButton> e) { if (Control == null) { SetNativeControl(new Box(System.Maui.Maui.NativeParent)); Control.SetLayoutCallback(OnLayout); _round = new Native.RoundRectangle(System.Maui.Maui.NativeParent); _round.Show(); _border = new Native.BorderRectangle(System.Maui.Maui.NativeParent); _border.Show(); _image = new Native.Image(System.Maui.Maui.NativeParent); _image.Show(); _button = new EButton(System.Maui.Maui.NativeParent) { Style = "transparent" }; _button.Clicked += OnClicked; _button.Pressed += OnPressed; _button.Released += OnReleased; _button.Show(); Control.PackEnd(_round); Control.PackEnd(_image); Control.PackEnd(_border); Control.PackEnd(_button); } base.OnElementChanged(e); }
public ShellNavBar() : base(Forms.NativeParent) { SetLayoutCallback(OnLayout); _menuButton = new EButton(Forms.NativeParent); _menuButton.Clicked += OnMenuClicked; _menuIcon = new EImage(Forms.NativeParent); UpdateMenuIcon(); _menuIcon.Show(); _menuButton.Show(); _menuButton.SetIconPart(_menuIcon); _title = new Native.Label(Forms.NativeParent) { FontSize = this.GetDefaultTitleFontSize(), VerticalTextAlignment = Native.TextAlignment.Center, TextColor = _titleColor, FontAttributes = FontAttributes.Bold, }; _title.Show(); BackgroundColor = _backgroudColor; _menuButton.BackgroundColor = _backgroudColor; PackEnd(_menuButton); PackEnd(_title); }
public ShellNavBar(IFlyoutController flyoutController) : base(Forms.NativeParent) { _flyoutController = flyoutController; _menuButton = new EButton(Forms.NativeParent); _menuButton.Clicked += OnMenuClicked; _menu = new EImage(Forms.NativeParent); UpdateMenuIcon(); _menu.Show(); _menuButton.Show(); _menuButton.SetPartContent("icon", _menu); _title = new Native.Label(Forms.NativeParent) { FontSize = Device.Idiom == TargetIdiom.TV ? 60 : 23, VerticalTextAlignment = Native.TextAlignment.Center, TextColor = _backgroudColor, FontAttributes = FontAttributes.Bold, }; _title.Show(); BackgroundColor = _backgroudColor; _menuButton.BackgroundColor = _backgroudColor; PackEnd(_menuButton); PackEnd(_title); LayoutUpdated += OnLayoutUpdated; }
void UpdateActionButtonVisible(bool visible) { if (_actionButton == null) { return; } if (visible) { _actionButton.Show(); } else { _actionButton.Hide(); } }
public EvasObject CreateMainPage(Window parent) { Box box = new Box(parent); box.Show(); _showEmbedded = new EButton(parent) { Text = "Show Embedded Page", WeightX = 1, AlignmentX = -1, }; _showEmbedded.Show(); _showEmbedded.Clicked += (sender, e) => ShowHello(); _showAlertsActionSheets = new EButton(parent) { Text = "Show Alerts and ActionSheets Page", WeightX = 1, AlignmentX = -1, }; _showAlertsActionSheets.Show(); _showAlertsActionSheets.Clicked += (sender, e) => ShowAlertsAndActionSheets(); _showWebView = new EButton(parent) { Text = "Show WebView Page", WeightX = 1, AlignmentX = -1, }; _showWebView.Show(); _showWebView.Clicked += (sender, e) => ShowWebView(); box.PackEnd(_showEmbedded); box.PackEnd(_showAlertsActionSheets); box.PackEnd(_showWebView); return(box); }
public override void Run(ElmSharp.Box parent) { var flyoutBox = new ElmSharp.Box(parent); var detailBox = new ElmSharp.Box(parent); var flyoutPage = new FlyoutPage(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, IsPresented = false, Flyout = flyoutBox, Detail = detailBox, }; flyoutPage.DimArea.BackgroundColor = EColor.Blue; flyoutPage.DimArea.Opacity = 100; var list = new GenList(parent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1 }; GenItemClass defaultClass = new GenItemClass("default") { GetTextHandler = (data, part) => { return(data as string); } }; for (int i = 0; i < 10; i++) { list.Append(defaultClass, $"Flyout List Item {i}"); } list.Show(); flyoutBox.PackEnd(list); var openLabel = new ElmSharp.Label(parent) { AlignmentX = 0.5, WeightX = 1, Text = $"IsPresented: {flyoutPage.IsPresented}" }; var gestureLabel = new ElmSharp.Label(parent) { AlignmentX = 0.5, WeightX = 1, Text = $"IsGestureEnabled: {flyoutPage.IsGestureEnabled}" }; var behaviorLabel = new ElmSharp.Label(parent) { AlignmentX = 0.5, WeightX = 1, Text = $"FlyoutLayoutBehavior: {flyoutPage.FlyoutLayoutBehavior}" }; var openButton = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "Open Flyout" }; var gestureButton = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "Enable/Disable Gesture" }; var behaviorButton = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "Default/Split Behavior" }; var sRatioButton = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "Split ratio + 10" }; var dRatioButton = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "popover ratio + 10" }; var sRatioButton2 = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "Split ratio - 10" }; var dRatioButton2 = new ElmSharp.Button(parent) { AlignmentX = -1, WeightX = 1, Text = "popover ratio - 10" }; list.ItemSelected += (s, e) => { flyoutPage.IsPresented = false; }; flyoutPage.IsPresentedChanged += (s, e) => { openLabel.Text = $"IsPresented: {flyoutPage.IsPresented}"; }; openButton.Clicked += (s, e) => { flyoutPage.IsPresented = !flyoutPage.IsPresented; }; gestureButton.Clicked += (s, e) => { flyoutPage.IsGestureEnabled = !flyoutPage.IsGestureEnabled; gestureLabel.Text = $"IsGestureEnabled: {flyoutPage.IsGestureEnabled}"; }; sRatioButton.Clicked += (s, e) => { flyoutPage.SplitRatio += 0.1; }; sRatioButton2.Clicked += (s, e) => { flyoutPage.SplitRatio -= 0.1; }; dRatioButton.Clicked += (s, e) => { flyoutPage.PopoverRatio += 0.1; }; dRatioButton2.Clicked += (s, e) => { flyoutPage.PopoverRatio -= 0.1; }; behaviorButton.Clicked += (s, e) => { if (flyoutPage.FlyoutLayoutBehavior == FlyoutLayoutBehavior.Default) { flyoutPage.FlyoutLayoutBehavior = FlyoutLayoutBehavior.Split; } else { flyoutPage.FlyoutLayoutBehavior = FlyoutLayoutBehavior.Default; } behaviorLabel.Text = $"FlyoutLayoutBehavior: {flyoutPage.FlyoutLayoutBehavior}"; openLabel.Text = $"IsPresented: {flyoutPage.IsPresented}"; }; openLabel.Show(); gestureLabel.Show(); behaviorLabel.Show(); openButton.Show(); gestureButton.Show(); behaviorButton.Show(); sRatioButton.Show(); sRatioButton2.Show(); dRatioButton.Show(); dRatioButton2.Show(); detailBox.PackEnd(openLabel); detailBox.PackEnd(gestureLabel); detailBox.PackEnd(behaviorLabel); detailBox.PackEnd(openButton); detailBox.PackEnd(gestureButton); detailBox.PackEnd(behaviorButton); detailBox.PackEnd(sRatioButton); detailBox.PackEnd(sRatioButton2); detailBox.PackEnd(dRatioButton); detailBox.PackEnd(dRatioButton2); flyoutBox.Show(); detailBox.Show(); flyoutPage.Show(); parent.PackEnd(flyoutPage); }