public MainWindow() { InitializeComponent(); _flex = new C1.WPF.FlexGrid.C1FlexGrid(); _flex.FontFamily = new System.Windows.Media.FontFamily("Arial"); _flex.FontSize = 15; _flex.GridLinesVisibility = C1.WPF.FlexGrid.GridLinesVisibility.All; _flex.AreRowGroupHeadersFrozen = false; _flex.MergeManager = null; _flex.GroupRowBackground = new SolidColorBrush(Colors.White); LayoutRoot.Children.Add(_flex); for (int i = 0; i < 10; i++) { var c = new C1.WPF.FlexGrid.Column(); c.Width = new GridLength(200); c.Header = "Column " + i.ToString(); _flex.Columns.Add(c); } // add rows AddRows(0); // apply custom cell factory _flex.CellFactory = new TreeCellFactory(); }
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(); }