Пример #1
0
            public NavigationViewTabItem(T value)
                : base(value)
            {
                Highlight = new ThemableBox {
                    Colour = ThemeSlot.AccentPrimary
                };

                Add(background = new ThemableBox
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ThemeSlot.Transparent,
                });

                Add(LabelContainer = new Container
                {
                    Margin = new MarginPadding {
                        Horizontal = 12
                    },
                    AutoSizeAxes     = Axes.X,
                    RelativeSizeAxes = Axes.Y,
                });

                if (Icon != null)
                {
                    LabelContainer.Add(icon = new ThemableSpriteIcon
                    {
                        Icon   = Icon ?? default,
                        Size   = new Vector2(16),
                        Colour = ThemeSlot.Black,
                        Anchor = Anchor.CentreLeft,
                        Origin = Anchor.CentreLeft,
                    });
Пример #2
0
        public FluentSearchBox()
        {
            PlaceholderText = @"Search";

            AddInternal(new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(GridSizeMode.Distributed),
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new Drawable[][]
                {
                    new Drawable[]
                    {
                        new Container
                        {
                            AutoSizeAxes     = Axes.X,
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeEasing   = Easing.OutQuint,
                            AutoSizeDuration = 200,
                            Child            = searchIcon = new ThemableSpriteIcon
                            {
                                Margin = new MarginPadding(8),
                                Icon   = FluentSystemIcons.Search16,
                                Size   = new Vector2(16),
                            },
                        },
                        Input,
                        new Container
                        {
                            AutoSizeAxes     = Axes.X,
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeEasing   = Easing.OutQuint,
                            AutoSizeDuration = 200,
                            Child            = clearButton = new FluentButton
                            {
                                Icon   = FluentSystemIcons.Dismiss16,
                                Width  = 32,
                                Style  = ButtonStyle.Text,
                                Action = () => Current.Value = string.Empty,
                            },
                        },
                    },
                },
            });

            Current.ValueChanged    += _ => updateState();
            Current.DisabledChanged += _ => updateState();

            updateState();
        }