Example #1
0
 void InitTracker()
 {
     if (tracker == null)
     {
         tracker = new TreeTrackingCanvas(this);
         AddChild(tracker);
         QueueForReallocate();
     }
 }
Example #2
0
        public TreeViewCellBounds()
        {
            MinHeight = 120;
            MinWidth  = 100;

            container = new VBox();
            TreeView  = new TreeView();
            TreeStore = new TreeStore(triState, check, text, desc);
            TreeView.GridLinesVisible = GridLines.Both;

            TreeView.Columns.Add("TriCheck", triState);
            TreeView.Columns.Add("Check", check);
            TreeView.Columns.Add("Item", text);
            TreeView.Columns.Add("Desc", desc, check, text);

            TreeView.DataSource = TreeStore;

            TreeStore.AddNode().SetValue(text, "One").SetValue(desc, "First").SetValue(triState, CheckBoxState.Mixed);
            TreeStore.AddNode().SetValue(text, "Two").SetValue(desc, "Second").AddChild()
            .SetValue(text, "Sub two").SetValue(desc, "Sub second");
            TreeStore.AddNode().SetValue(text, "Three").SetValue(desc, "Third").AddChild()
            .SetValue(text, "Sub three").SetValue(desc, "Sub third");

            TreeView.ExpandAll();


            TreeView.SelectionChanged += (sender, e) => UpdateTracker(TreeView.SelectedRow);
            TreeView.MouseMoved       += (sender, e) => UpdateTracker(TreeView.GetRowAtPosition(e.X, e.Y));

            drawer = new TreeTrackingCanvas(this);

            container.PackStart(TreeView, true);
            container.PackStart(drawer);
            AddChild(container);

            if (currentRow == null)
            {
                currentRow = TreeStore.GetFirstNode();
            }
        }