Ejemplo n.º 1
0
        private static void populateItems(UPathLabels ctrl)
        {
            ctrl.pnlMain.Children.Clear();

            ObservableCollection <MVOrgChart> arr = new ObservableCollection <MVOrgChart>(ctrl.ItemSources);

            MVOrgChart root = new MVOrgChart(new CTable(""));

            root.DirectoryID       = "";
            root.ParentDirectoryID = "";
            root.DirectoryName     = "/";
            arr.Insert(0, root);

            int i = 0;

            foreach (MVOrgChart obj in arr)
            {
                i++;

                Border bdr = new Border();
                bdr.BorderThickness = new Thickness(1);
                bdr.BorderBrush     = Brushes.Blue;
                bdr.CornerRadius    = new CornerRadius(2);
                bdr.Padding         = new Thickness(10, 5, 10, 5);

                if (i == 1)
                {
                    bdr.Margin = new Thickness(0, 0, 0, 0);
                }
                else
                {
                    bdr.Margin = new Thickness(5, 0, 0, 0);
                }

                TextBlock tb = new TextBlock();
                tb.Foreground = Brushes.Black;
                tb.Text       = obj.DirectoryName;
                if (i != arr.Count)
                {
                    if (ctrl.IsClickAble)
                    {
                        tb.Foreground  = Brushes.Blue;
                        tb.MouseDown  += new MouseButtonEventHandler(ctrl.TextBlock_MouseDown);
                        tb.MouseEnter += new MouseEventHandler(ctrl.TextBlock_MouseEnter);
                        tb.MouseLeave += new MouseEventHandler(ctrl.TextBlock_MouseLeave);
                    }
                }

                tb.Tag = obj;

                bdr.Child = tb;

                ctrl.pnlMain.Children.Add(bdr);
            }
        }
Ejemplo n.º 2
0
        private static void OnSelectedItemSourcesEvtChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            UPathLabels ctrl = obj as UPathLabels;

            populateItems(ctrl);
        }