public MainWindow()
        {
            InitializeComponent();

            // ensure flex template has been loaded
            _flex.ApplyTemplate();

            // make rows tall enough to show our custom objects
            _flex.Rows.DefaultSize = 50;

            // no editing
            _flex.IsReadOnly = true;

            // create unbound rows and columns
            for (int r = 0; r < 50; r++)
            {
                _flex.Rows.Add(new Row());
            }
            for (int c = 0; c < 10; c++)
            {
                _flex.Columns.Add(new Column());
            }

            // create objects (model) and assign them to grid cells
            for (int r = 0; r < _flex.Rows.Count; r++)
            {
                for (int c = 0; c < _flex.Columns.Count; c++)
                {
                    if ((r + c) % 2 == 0)
                    {
                        _flex[r, c] = new MyDataObject(r, c);
                    }
                }
            }

            // register flex as drop target
            var ddMgr = new C1DragDropManager();

            ddMgr.RegisterDropTarget(_flex, true);
            ddMgr.DragStart += DdMgr_DragStart;
            ddMgr.DragDrop  += _ddMgr_DragDrop;

            // activate custom cell factory
            _flex.CellFactory = new MyCellFactory(ddMgr);
        }
Ejemplo n.º 2
0
        public MyViewObject(C1FlexGrid flex, MyDataObject data)
        {
            _flex = flex;
            DataObject = data;

            Orientation = System.Windows.Controls.Orientation.Vertical;

            var tb1 = new TextBlock();
            tb1.Text = data.Name;
            tb1.HorizontalAlignment = HorizontalAlignment.Center;
            tb1.FontSize = 12;
            Children.Add(tb1);

            var tb2 = new TextBlock();
            tb2.Text = data.Temperature.ToString();
            tb2.HorizontalAlignment = HorizontalAlignment.Center;
            tb2.FontSize = 8;
            Children.Add(tb2);
        }
Ejemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            // ensure flex template has been loaded
            _flex.ApplyTemplate();

            // make rows tall enough to show our custom objects
            _flex.Rows.DefaultSize = 50;

            // no editing
            _flex.IsReadOnly = true;

            // create unbound rows and columns
            for (int r = 0; r < 50; r++)
            {
                _flex.Rows.Add(new Row());
            }
            for (int c = 0; c < 10; c++)
            {
                _flex.Columns.Add(new Column());
            }

            // create objects (model) and assign them to grid cells
            for (int r = 0; r < _flex.Rows.Count; r++)
            {
                for (int c = 0; c < _flex.Columns.Count; c++)
                {
                    if ((r + c) % 2 == 0)
                    {
                        _flex[r, c] = new MyDataObject(r, c);
                    }
                }
            }

            // register flex as drop target
            var ddMgr = new C1DragDropManager();
            ddMgr.RegisterDropTarget(_flex, true);
            ddMgr.DragDrop += _ddMgr_DragDrop;

            // activate custom cell factory
            _flex.CellFactory = new MyCellFactory(ddMgr);
        }
Ejemplo n.º 4
0
        public MyViewObject(C1FlexGrid flex, MyDataObject data)
        {
            _flex      = flex;
            DataObject = data;

            Orientation = System.Windows.Controls.Orientation.Vertical;

            var tb1 = new TextBlock();

            tb1.Text = data.Name;
            tb1.HorizontalAlignment = HorizontalAlignment.Center;
            tb1.FontSize            = 12;
            Children.Add(tb1);

            var tb2 = new TextBlock();

            tb2.Text = data.Temperature.ToString();
            tb2.HorizontalAlignment = HorizontalAlignment.Center;
            tb2.FontSize            = 8;
            Children.Add(tb2);
        }