void UpdateActionButtonIcon(ImageSource source) { if (source is FileImageSource filesource) { var path = ResourcePath.GetPath(filesource); var buttonImage = new ElmSharp.Image(_actionButton); buttonImage.Load(path); buttonImage.Show(); _actionButton.SetPartContent("elm.swallow.content", buttonImage); } else { _actionButton.SetPartContent("elm.swallow.content", null); } }
public ShellNavBar(IFlyoutController flyoutController) : base(System.Maui.Maui.NativeParent) { _flyoutController = flyoutController; _menuButton = new EButton(System.Maui.Maui.NativeParent); _menuButton.Clicked += OnMenuClicked; _menu = new EImage(System.Maui.Maui.NativeParent); UpdateMenuIcon(); _menu.Show(); _menuButton.Show(); _menuButton.SetPartContent("icon", _menu); _title = new Native.Label(System.Maui.Maui.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; }
public static bool SetIconPart(this EButton button, EvasObject content, bool preserveOldContent = false) { return(button.SetPartContent(ThemeConstants.Button.Parts.Icon, content, preserveOldContent)); }