コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            // populate the grid
            if (UNBOUND)
            {
                // add columns
                foreach (PropertyInfo pi in typeof(Product).GetProperties())
                {
                    var c = new C1.WPF.FlexGrid.Column();
                    c.ColumnName = pi.Name;
                    c.DataType = pi.PropertyType;
                    _flex.Columns.Add(c);
                }

                // add rows
                foreach (var item in Product.GetProducts(100))
                {
                    var r = new C1.WPF.FlexGrid.Row();
                    _flex.Rows.Add(r);
                    foreach (PropertyInfo pi in typeof(Product).GetProperties())
                    {
                        r[pi.Name] = pi.GetValue(item, null);
                    }
                }
            }
            else
            {
                _flex.ItemsSource = Product.GetProducts(100);
            }

            // create filter row
            _flex.CellFactory = new FilterRowCellFactory();
        }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            // populate the grid
            if (UNBOUND)
            {
                // add columns
                foreach (PropertyInfo pi in typeof(Product).GetProperties())
                {
                    var c = new C1.WPF.FlexGrid.Column();
                    c.ColumnName = pi.Name;
                    c.DataType   = pi.PropertyType;
                    _flex.Columns.Add(c);
                }

                // add rows
                foreach (var item in Product.GetProducts(100))
                {
                    var r = new C1.WPF.FlexGrid.Row();
                    _flex.Rows.Add(r);
                    foreach (PropertyInfo pi in typeof(Product).GetProperties())
                    {
                        r[pi.Name] = pi.GetValue(item, null);
                    }
                }
            }
            else
            {
                _flex.ItemsSource = Product.GetProducts(100);
            }

            // create filter row
            _flex.CellFactory = new FilterRowCellFactory();
        }