private double GetLeftHeight() { ExpandDockItem item = this; int count = 0; while (item.ItemParent is ExpandDockItem) { count += ((ExpandDockItem)item.ItemParent).ItemChildren.Count; if (item.ItemParent is ExpandDockItem) { item = (ExpandDockItem)item.ItemParent; } else { break; } } double height = 0; if (item.Parent is ExpandDockPanel) { ExpandDockPanel panel = (ExpandDockPanel)item.Parent; count += panel.Items.Count; height = count * (((Button)this.Children[0]).ActualHeight); height = panel.ActualHeight - height; } return(height); }
public ExpandDockItem(ExpandDockItemData data, UIElement itemParent) { self = data; itemparent = itemParent; HeaderItem button = new HeaderItem(); button.HeaderType = data.Type; button.Click += new RoutedEventHandler(button_Click); button.Content = data.Name; button.SetValue(DockPanel.DockProperty, Dock.Top); this.Children.Add(button); stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Vertical; if (data.Children.Count > 0) { foreach (ExpandDockItemData kv in data.Children) { ExpandDockItem item = new ExpandDockItem(kv, this); kv.UI = item; item.SetValue(DockProperty, Dock.Top); stackPanel.Children.Add(item); } stackPanel.Height = 0; } this.Children.Add(stackPanel); }
public bool Expand(string itemid) { bool bret = false; List <ExpandDockItem> items = (from kv in datas where kv.Areafnbr == itemid select(ExpandDockItem)(kv.UI)).ToList <ExpandDockItem>(); if (items.Count > 0) { items[0].bExpand = true; //name=items[0].Name; bret = true; } else { ExpandDockItem item = null; foreach (ExpandDockItem kv in Items) { if ((item = kv.FindChild(itemid)) != null) { ((ExpandDockItem)item.ItemParent).bExpand = true; //name = ((ExpandDockItem)item.ItemParent).Name; break; } } } return(bret); }
public void AddItem(ExpandDockItem item) { if (stackPanel == null) { stackPanel = new StackPanel(); this.Children.Add(stackPanel); } item.ItemParent = this; stackPanel.Children.Add(item); }
public ExpandDockItem FindChild(string id) { ExpandDockItem item = null; List <ExpandDockItem> items = (from kv in ItemChildren where kv.Context.Areafnbr == id select kv).ToList <ExpandDockItem>(); if (items.Count > 0) { item = items[0]; } else { foreach (ExpandDockItem kv in ItemChildren) { if ((item = kv.FindChild(id)) != null) { break; } } } return(item); }
public string GetItemContext(string itemid) { string ret = ""; List <ExpandDockItem> items = (from kv in datas where kv.Areafnbr == itemid select(ExpandDockItem)(kv.UI)).ToList <ExpandDockItem>(); if (items.Count > 0) { foreach (UIElement kv in items[0].Children) { if (kv is Button) { Button btn = (Button)kv; ret = btn.Content.ToString(); break; } } } else { ExpandDockItem item = null; foreach (ExpandDockItem kv in Items) { if ((item = kv.FindChild(itemid)) != null) { foreach (UIElement k in item.Children) { if (k is Button) { Button btn = (Button)k; ret = btn.Content.ToString(); break; } } break; } } } return(ret); }
public void SetItemContext(string itemid, string content) { List <ExpandDockItem> items = (from kv in datas where kv.Areafnbr == itemid select(ExpandDockItem)(kv.UI)).ToList <ExpandDockItem>(); if (items.Count > 0) { foreach (UIElement kv in items[0].Children) { if (kv is Button) { Button btn = (Button)kv; btn.Content = content; break; } } } else { ExpandDockItem item = null; foreach (ExpandDockItem kv in Items) { if ((item = kv.FindChild(itemid)) != null) { foreach (UIElement k in item.Children) { if (k is Button) { Button btn = (Button)k; btn.Content = content; break; } } break; } } } }