Beispiel #1
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);
        }
Beispiel #2
0
        public ShellItemRenderer(IFlyoutController flyoutController, ShellItem item)
        {
            _flyoutController           = flyoutController;
            _shellItem                  = item;
            _shellItem.PropertyChanged += OnShellItemPropertyChanged;
            (_shellItem.Items as INotifyCollectionChanged).CollectionChanged += OnShellItemsCollectionChanged;

            _box = new Native.Box(System.Maui.Maui.NativeParent);
            _box.LayoutUpdated += OnLayoutUpdated;
            _box.Show();

            // Create Tabs
            _tabs = CreateTabs();
            _tabs.TargetView.Show();
            Control.PackEnd(_tabs as EvasObject);
            InitializeTabs();

            // Create More Tabs
            _more = CreateMoreToolbar();
            _more.Show();

            _drawer = CreateDrawer();
            _drawer.Show();
            Control.PackEnd(_drawer);
            InitialzeDrawer(_more);

            ResetToolbarItems();

            UpdateCurrentShellSection(_shellItem.CurrentItem);
            if (_drawer != null)
            {
                _currentSection?.StackBelow(_drawer);
            }

            ((IShellController)_shellItem.Parent).AddAppearanceObserver(this, _shellItem);
        }