Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        EvasObject GetContent(object data, string part)
        {
            ShellSection section = data as ShellSection;

            var box = new Native.Box(System.Maui.Maui.NativeParent);

            box.Show();

            var icon = new Native.Image(System.Maui.Maui.NativeParent)
            {
                MinimumWidth  = System.Maui.Maui.ConvertToScaledPixel(44),
                MinimumHeight = System.Maui.Maui.ConvertToScaledPixel(27)
            };
            var task = icon.LoadFromImageSourceAsync(section.Icon);

            icon.Show();

            var title = new Native.Label(System.Maui.Maui.NativeParent)
            {
                Text     = section.Title,
                FontSize = System.Maui.Maui.ConvertToEflFontPoint(14),
                HorizontalTextAlignment = Native.TextAlignment.Start,
                VerticalTextAlignment   = Native.TextAlignment.Center
            };

            title.Show();

            box.PackEnd(icon);
            box.PackEnd(title);
            box.LayoutUpdated += (object sender, LayoutEventArgs e) =>
            {
                icon.Move(e.Geometry.X + _iconPadding, e.Geometry.Y + _iconPadding);
                icon.Resize(_iconSize, _iconSize);

                title.Move(e.Geometry.X + 2 * _iconPadding + _iconSize, e.Geometry.Y);
                title.Resize(e.Geometry.Width - (2 * _iconPadding + _iconSize), e.Geometry.Height);
            };
            box.MinimumHeight = _cellHeight;
            return(box);
        }