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) => { 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 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) => { SecondButton.Activate(); }; } else { _secondButton = null; } _popUp.SetPartContent("button2", _secondButton); }