void UpdateSecondButton() { _secondButton?.Hide(); if (SecondButton != null) { _secondButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/right" }; if (!string.IsNullOrEmpty(SecondButton.Text)) { _secondButton.Text = SecondButton.Text; } if (SecondButton.Icon != null) { var iconPath = SecondButton.Icon.File; if (!string.IsNullOrEmpty(iconPath)) { var buttonImage = new ElmSharp.Image(_secondButton); buttonImage.LoadAsync(ResourcePath.GetPath(iconPath)); buttonImage.Show(); _secondButton.SetPartContent("elm.swallow.content", buttonImage); } } _secondButton.Clicked += (s, e) => { ((IMenuItemController)SecondButton).Activate(); }; if (_secondButtonBgColor != Color.Default) { Console.WriteLine($"TwoButtonPopup set second button background color:{_secondButtonBgColor.ToNative()}"); _secondButton.BackgroundColor = _secondButtonBgColor.ToNative(); } _popUp.SetPartContent("button2", _secondButton); } else { /* This is workaround fix for Left button occupied whole window when right button is null*/ _secondButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/right" }; _popUp.SetPartContent("button2", _secondButton); _secondButton.Unrealize(); _secondButton = null; } }
void UpdatePopupBackgroundColor() { Xamarin.Forms.Color bgColor = ((PopupEntry)Element).PopupBackgroundColor; if (bgColor == Xamarin.Forms.Color.Default) { _popupBackgroundColor = DefaultColor; } else { _popupBackgroundColor = bgColor.ToNative(); } }
void UpdateFirstButton() { _firstButton?.Hide(); if (FirstButton != null) { _firstButton = new ElmSharp.Button(_popUp) { WeightX = 1.0, WeightY = 1.0, Style = "popup/circle/left" }; if (!string.IsNullOrEmpty(FirstButton.Text)) { _firstButton.Text = FirstButton.Text; } if (FirstButton.Icon != null) { var iconPath = FirstButton.Icon.File; if (!string.IsNullOrEmpty(iconPath)) { var buttonImage = new ElmSharp.Image(_firstButton); buttonImage.LoadAsync(ResourcePath.GetPath(iconPath)); buttonImage.Show(); _firstButton.SetPartContent("elm.swallow.content", buttonImage); } } _firstButton.Clicked += (s, e) => { ((IMenuItemController)FirstButton).Activate(); }; if (_firstButtonBgColor != Color.Default) { Console.WriteLine($"TwoButtonPopup set first button background color:{_firstButtonBgColor.ToNative()}"); _firstButton.BackgroundColor = _firstButtonBgColor.ToNative(); } } else { _firstButton = null; } _popUp.SetPartContent("button1", _firstButton); }
void UpdatePopupBackgroundColor() { Xamarin.Forms.Color bgColor = ((PopupEntry)Element).PopupBackgroundColor; if (bgColor == Xamarin.Forms.Color.Default) { _popupBackgroundColor = DefaultColor; } else { _popupBackgroundColor = bgColor.ToNative(); } if (_IsPopupOpened == true && _editorPopup != null) { _editorPopup.Color = _popupBackgroundColor; } }