protected override void RegisterItemInfo() { base.RegisterItemInfo(); BarItemInfo list = ItemInfoCollection[MyBarButtonItem.BaseBarItemName]; ItemInfoCollection.Add(new BarItemInfo(MyBarButtonItem.BarItemName, MyBarButtonItem.BarItemCaption, -1, typeof(MyBarButtonItem), list.LinkType, list.ViewInfoType, list.LinkPainter, true, false)); }
private void Form1_Load(object sender, EventArgs e) { DataTable table = CreateTable(30); gridControl1.DataSource = table; foreach (DataRow row in table.Select("ParentId = -1", "Id asc")) { BarItem barItem = null; int childrenCount = table.AsEnumerable().Count(r => (int)r["ParentId"] == (int)row["Id"]); if (childrenCount > 0) { barItem = new BarSubItem(); DataTable childrenTable = table.AsEnumerable().Where(r => (int)r["ParentId"] == (int)row["Id"]).CopyToDataTable(); ((BarSubItem)barItem).AddItems(CreateChildrenLinks(barItem, childrenTable)); } else { BarItemInfo itemInfo = (BarItemInfo)row["ItemKind"]; barItem = System.Activator.CreateInstance(itemInfo.ItemType) as BarItem; } barItem.Name = ((string)row["Caption"]).ToLower(); barItem.Caption = (string)row["Caption"]; barItem.Manager = barManager1; bar1.AddItem(barItem); } }
private BarItem[] CreateChildrenLinks(BarItem parentItem, DataTable childrenTable) { List <BarItem> items = new List <BarItem>(); foreach (DataRow row in childrenTable.Rows) { BarItem barItem = null; int childrenCount = childrenTable.AsEnumerable().Count(r => (int)r["ParentId"] == (int)row["Id"]); if (childrenCount > 0) { barItem = new BarSubItem(); DataTable table = childrenTable.AsEnumerable().Where(r => (int)r["ParentId"] == (int)row["Id"]).CopyToDataTable(); ((BarSubItem)barItem).AddItems(CreateChildrenLinks(barItem, table)); } else { BarItemInfo itemInfo = (BarItemInfo)row["ItemKind"]; barItem = System.Activator.CreateInstance(itemInfo.ItemType) as BarItem; } barItem.Name = ((string)row["Caption"]).ToLower(); barItem.Caption = (string)row["Caption"]; barItem.Manager = barManager1; items.Add(barItem); } return(items.ToArray()); }
public static void Register(BarManagerPaintStyleCollection styles) { foreach (BarManagerPaintStyle paintStyle in styles) { BarItemInfo list = paintStyle.ItemInfoCollection[BaseBarItemName]; if (list != null && paintStyle.ItemInfoCollection[BarItemName] == null) { paintStyle.ItemInfoCollection.Add(new BarItemInfo(BarItemName, BarItemCaption, -1, typeof(MyBarButtonItem), list.LinkType, list.ViewInfoType, list.LinkPainter, true, false)); } } }
public static void Register(BarManagerPaintStyleCollection styles) { for (int i = 0; i < styles.Count; i++) { BarManagerPaintStyle paintStyle = styles[i]; BarItemInfo list = paintStyle.ItemInfoCollection[BaseBarItemName]; if (list != null && paintStyle.ItemInfoCollection[BarItemName] == null) { paintStyle.ItemInfoCollection.Add(new BarItemInfo(BarItemName, BarItemCaption, -1, typeof(BarTransparentButtonItem), list.LinkType, typeof(BarTransparentButtonLinkViewInfo), list.LinkPainter, true, false)); } } }