Esempio n. 1
0
 void InitTracker()
 {
     if (tracker == null)
     {
         tracker = new ListTrackingCanvas(this);
         AddChild(tracker);
         QueueForReallocate();
     }
 }
Esempio n. 2
0
        public ListViewCellBounds()
        {
            MinHeight = 120;
            MinWidth  = 100;

            container = new VBox();
            ListView  = new ListView();

            ListView.GridLinesVisible = GridLines.Both;
            ListStore           = new ListStore(name, icon, text, check, progress);
            ListView.DataSource = ListStore;
            ListView.Columns.Add("Name", icon, name);
            ListView.Columns.Add("Check", new TextCellView()
            {
                TextField = text
            }, new CustomCell()
            {
                ValueField = progress, Size = new Size(20, 20)
            }, new CheckBoxCellView()
            {
                ActiveField = check
            });
            //list.Columns.Add ("Progress", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress }, new TextCellView () { TextField = text } );
            ListView.Columns.Add("Progress", new CustomCell()
            {
                ValueField = progress
            });

            var png = Image.FromResource(typeof(App), "class.png");

            Random rand = new Random();

            for (int n = 0; n < 100; n++)
            {
                var r = ListStore.AddRow();
                ListStore.SetValue(r, icon, png);
                if (rand.Next(50) > 25)
                {
                    ListStore.SetValue(r, name, "Value \n" + n);
                    ListStore.SetValue(r, check, false);
                }
                else
                {
                    ListStore.SetValue(r, name, "Value " + n);
                    ListStore.SetValue(r, check, true);
                }
                ListStore.SetValue(r, text, "Text " + n);
                ListStore.SetValue(r, progress, new CellData {
                    Value = rand.Next() % 100
                });
            }

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

            drawer = new ListTrackingCanvas(this);

            container.PackStart(ListView, true);
            container.PackStart(drawer);
            AddChild(container);
        }