Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public void AddItem(ExpandDockItem item)
 {
     if (stackPanel == null)
     {
         stackPanel = new StackPanel();
         this.Children.Add(stackPanel);
     }
     item.ItemParent = this;
     stackPanel.Children.Add(item);
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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;
                    }
                }
            }
        }
Esempio n. 8
0
        public void AddItem(ExpandDockItem item)
        {
            if (stackPanel == null)
            {
                stackPanel = new StackPanel();
                this.Children.Add(stackPanel);
            }
            item.ItemParent = this;
            stackPanel.Children.Add(item);

        }
Esempio n. 9
0
        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);

        }