Ejemplo n.º 1
0
 public HelpHeader()
 {
     Masking          = true;
     RelativeSizeAxes = Axes.X;
     Children         = new Drawable[]
     {
         new ThemableBox
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = ThemeSlot.AccentSecondary,
         },
         new FillFlowContainer
         {
             AutoSizeAxes     = Axes.Y,
             RelativeSizeAxes = Axes.X,
             Anchor           = Anchor.CentreLeft,
             Origin           = Anchor.CentreLeft,
             Padding          = new MarginPadding {
                 Left = 30
             },
             Direction = FillDirection.Vertical,
             Children  = new Drawable[]
             {
                 new ThemableSpriteText
                 {
                     Text   = "Knowledgebase",
                     Font   = SegoeUI.Bold.With(size: 32),
                     Colour = ThemeSlot.Black,
                 },
                 new ThemableSpriteText
                 {
                     Text   = "Learn Vignette",
                     Font   = SegoeUI.Regular.With(size: 16),
                     Colour = ThemeSlot.Black,
                 },
                 SearchBox = new FluentSearchBox
                 {
                     Width  = 500,
                     Style  = TextBoxStyle.Borderless,
                     Margin = new MarginPadding {
                         Top = 20
                     },
                 }
             },
         },
     };
 }
Ejemplo n.º 2
0
        public SettingsScreen()
        {
            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                RowDimensions    = new[]
                {
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(),
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new Drawable[][]
                {
                    new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new ThemableBox
                                {
                                    Height           = 2,
                                    RelativeSizeAxes = Axes.X,
                                    Colour           = ThemeSlot.Gray30,
                                    Anchor           = Anchor.BottomCentre,
                                    Origin           = Anchor.BottomCentre,
                                },
                                navigation = new SettingsNavigation
                                {
                                    RelativeSizeAxes = Axes.X,
                                },
                                searchBox = new FluentSearchBox
                                {
                                    Margin = new MarginPadding {
                                        Right = 10
                                    },
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Width  = 200,
                                    Style  = TextBoxStyle.Underlined,
                                },
                            }
                        }
                    },
                    new Drawable[]
                    {
                        scrollContainer = new FluentScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Child            = sectionFlow = new SearchContainer
                            {
                                Width            = 0.8f,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Anchor           = Anchor.TopCentre,
                                Origin           = Anchor.TopCentre,
                            },
                        }
                    },
                    new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new ThemableBox
                                {
                                    Height           = 2,
                                    RelativeSizeAxes = Axes.X,
                                    Colour           = ThemeSlot.Gray30,
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Padding      = new MarginPadding {
                                        Vertical = 10, Right = 20
                                    },
                                    Direction = FillDirection.Horizontal,
                                    Spacing   = new Vector2(10, 0),
                                    Anchor    = Anchor.TopRight,
                                    Origin    = Anchor.TopRight,
                                    Children  = new Drawable[]
                                    {
                                        new FluentButton
                                        {
                                            Text         = "Scroll to Top",
                                            Style        = ButtonStyle.Text,
                                            AutoSizeAxes = Axes.X,
                                            Action       = () => scrollContainer.ScrollToStart(),
                                        },
                                    },
                                }
                            }
                        }
                    },
                }
            };

            navigation.Current.ValueChanged += e =>
            {
                if (!hasInitialized)
                {
                    hasInitialized = true;
                    return;
                }

                if (lastSection != e.NewValue)
                {
                    lastSection = e.NewValue;

                    if (lastSection != null)
                    {
                        scrollContainer.ScrollTo(lastSection);
                    }

                    lastSection?.Highlight();
                }
            };

            selectedSection.ValueChanged += e =>
            {
                if (lastSection != e.NewValue)
                {
                    lastSection = e.NewValue;
                    navigation.Current.Value = lastSection;
                }
            };

            searchBox.Current.ValueChanged += e => sectionFlow.SearchTerm = e.NewValue;
        }