예제 #1
0
 protected virtual BottomSheetDialog CreateMoreBottomSheet(Action <ShellSection, BottomSheetDialog> selectCallback)
 {
     return(CreateMoreBottomSheet((int index, BottomSheetDialog dialog) =>
     {
         selectCallback(ShellItemController.GetItems()[index], dialog);
     }));
 }
예제 #2
0
        void UpdateBottomBar()
        {
            _BottomBar.Children.Clear();
            _BottomBar.ColumnDefinitions.Clear();
            var items = ShellItemController?.GetItems();

            if (items?.Count > 1)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    var section = items[i];
                    var btn     = new AppBarButton()
                    {
                        Label    = section.Title,
                        Width    = double.NaN,
                        MinWidth = 68,
                        MaxWidth = 200
                    };

                    switch (section.Icon)
                    {
                    case FileImageSource fileImageSource:
                        btn.Icon = new BitmapIcon()
                        {
                            UriSource = new Uri("ms-appx:///" + fileImageSource.File)
                        };
                        break;

                    case FontImageSource fontImageSource:

                        var icon = new FontIcon()
                        {
                            Glyph      = fontImageSource.Glyph,
                            FontFamily = new FontFamily(fontImageSource.FontFamily),
                            FontSize   = fontImageSource.Size,
                        };

                        if (!fontImageSource.Color.IsDefault())
                        {
                            icon.Foreground = fontImageSource.Color.ToNative();
                        }

                        btn.Icon = icon;
                        break;
                    }

                    btn.Click += (s, e) => OnShellSectionClicked(section);
                    _BottomBar.ColumnDefinitions.Add(new UwpColumnDefinition()
                    {
                        Width = WinUIHelpers.CreateGridLength(1, UwpGridUnitType.Star)
                    });
                    SetColumn(btn, i);
                    _BottomBar.Children.Add(btn);
                }
            }
        }
예제 #3
0
 void OnVisibleChildRemoved(Element child)
 {
     if (CurrentItem == child)
     {
         if (ShellItemController.GetItems().Count == 0)
         {
             ClearValue(CurrentItemProperty);
         }
         else
         {
             SetValueFromRenderer(CurrentItemProperty, ShellItemController.GetItems()[0]);
         }
     }
 }
예제 #4
0
 protected override void OnChildRemoved(Element child)
 {
     base.OnChildRemoved(child);
     if (CurrentItem == child)
     {
         if (ShellItemController.GetItems().Count == 0)
         {
             ClearValue(CurrentItemProperty);
         }
         else
         {
             SetValueFromRenderer(CurrentItemProperty, ShellItemController.GetItems()[0]);
         }
     }
 }
예제 #5
0
 void OnMoreItemSelected(int shellSectionIndex, BottomSheetDialog dialog)
 {
     OnMoreItemSelected(ShellItemController.GetItems()[shellSectionIndex], dialog);
 }