Exemplo n.º 1
0
        protected override void InsertItem(ListItem item, int index)
        {
            item.Changed += ItemOnChanged;

            Widget widget = null;

            if (!item.IsSeparator)
            {
                widget = new ListButton(ListBoxStyle.ListItemStyle, this)
                {
                    Text                = item.Text,
                    TextColor           = item.Color ?? ListBoxStyle.ListItemStyle.LabelStyle.TextColor,
                    Tag                 = item,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Image               = item.Image,
                    ImageTextSpacing    = item.ImageTextSpacing
                };

                ((Button)widget).Click += ButtonOnClick;
            }
            else
            {
                widget = new HorizontalSeparator(ListBoxStyle.SeparatorStyle);
            }

            InternalChild.RowsProportions.Insert(index, new Proportion(ProportionType.Auto));
            InternalChild.Widgets.Insert(index, widget);

            item.Widget = widget;

            UpdateGridPositions();
        }
Exemplo n.º 2
0
        protected override void InsertItem(ListItem item, int index)
        {
            item.Changed += ItemOnChanged;

            Widget widget = null;

            if (!item.IsSeparator)
            {
                widget = new ListButton(ListBoxStyle.ListItemStyle, this)
                {
                    Text                = item.Text,
                    TextColor           = item.Color ?? ListBoxStyle.ListItemStyle.LabelStyle.TextColor,
                    Tag                 = item,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Image               = item.Image,
                    ImageTextSpacing    = item.ImageTextSpacing
                };

                ((ImageTextButton)widget).Click += ButtonOnClick;
            }
            else
            {
                var separator = new HorizontalSeparator(null);
                separator.ApplySeparatorStyle(ListBoxStyle.SeparatorStyle);
                widget = separator;
            }

            _box.Widgets.Insert(index, widget);

            item.Widget = widget;
        }
Exemplo n.º 3
0
        protected override void InsertItem(TabItem item, int index)
        {
            item.Changed += ItemOnChanged;

            ImageTextButton button = new ListButton(TabControlStyle.TabItemStyle, this)
            {
                Text                = item.Text,
                TextColor           = item.Color ?? TabControlStyle.TabItemStyle.LabelStyle.TextColor,
                Tag                 = item,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Image               = item.Image,
                ImageTextSpacing    = item.ImageTextSpacing
            };

            button.Click += ButtonOnClick;

            _gridButtons.ColumnsProportions.Insert(index, new Proportion(ProportionType.Auto));
            _gridButtons.Widgets.Insert(index, button);

            item.Button = button;

            UpdateGridPositions();

            if (Items.Count == 1)
            {
                // Select first item
                SelectedItem = item;
            }
        }
Exemplo n.º 4
0
        protected override void InsertItem(ListItem item, int index)
        {
            item.Changed += ItemOnChanged;

            var button = new ListButton(_dropDownItemStyle, this)
            {
                Text      = item.Text,
                TextColor = item.Color ?? _dropDownItemStyle.LabelStyle.TextColor,
                Tag       = item
            };

            item.Widget = button;

            button.Click += ItemOnClick;

            button.HorizontalAlignment = HorizontalAlignment.Stretch;
            button.VerticalAlignment   = VerticalAlignment.Stretch;
            _itemsContainer.Widgets.Insert(index, button);

            UpdateSelectedItem();
        }
Exemplo n.º 5
0
        private void InsertItem(ListItem item, int index)
        {
            item.Changed += ItemOnChanged;

            var button = new ListButton(_dropDownItemStyle)
            {
                Text      = item.Text,
                TextColor = item.Color ?? _dropDownItemStyle.LabelStyle.TextColor,
                Tag       = item
            };

            item.Widget = button;

            button.MouseEntered += ItemOnMouseEntered;
            button.Click        += ItemOnClick;

            button.HorizontalAlignment = HorizontalAlignment.Stretch;
            button.VerticalAlignment   = VerticalAlignment.Stretch;
            _itemsContainer.RowsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            _itemsContainer.Widgets.Insert(index, button);

            UpdateSelectedItem();
            UpdateGridPositions();
        }