예제 #1
0
        public ShellSectionRenderer(ShellSection section)
        {
            _section = section;
            _section.PropertyChanged += OnSectionPropertyChanged;
            (_section.Items as INotifyCollectionChanged).CollectionChanged += OnShellSectionCollectionChanged;

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

            _tabs = CreateToolbar();
            _tabs.TargetView.Show();
            Control.PackEnd(_tabs as EvasObject);
            InitializeTabs();

            ResetToolbarItem();
            UpdateCurrentShellContent(_section.CurrentItem);

            ((IShellController)_section.Parent.Parent).AddAppearanceObserver(this, _section);
        }
예제 #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);
        }
예제 #3
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);
        }