private void InsertItem(ListItem item, int index) { item.Changed += ItemOnChanged; Widget widget = null; if (!item.IsSeparator) { widget = new Button(ListBoxStyle.ListItemStyle) { Text = item.Text, TextColor = item.Color ?? ListBoxStyle.ListItemStyle.LabelStyle.TextColor, Tag = item, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Image = item.Image, ImageTextSpacing = item.ImageTextSpacing, Toggleable = true }; ((Button)widget).Down += ButtonOnDown; } else { widget = new HorizontalSeparator(ListBoxStyle.SeparatorStyle); } RowsProportions.Insert(index, new Proportion(ProportionType.Auto)); Widgets.Insert(index, widget); item.Widget = widget; UpdateGridPositions(); }
private void InsertItem(ListItem item, int index) { item.Changed += ItemOnChanged; var widget = new Button(ListBoxItemStyle) { Text = item.Text, TextColor = item.Color ?? ListBoxItemStyle.LabelStyle.TextColor, Tag = item, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Toggleable = true }; widget.Down += ButtonOnDown; RowsProportions.Insert(index, new Proportion(ProportionType.Auto)); Widgets.Insert(index, widget); item.Widget = widget; UpdateGridPositions(); }