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 override FrameworkElement CreateCell(C1.WPF.FlexGrid.C1FlexGrid grid, C1.WPF.FlexGrid.CellType cellType, C1.WPF.FlexGrid.CellRange range) { var cell = base.CreateCell(grid, cellType, range); if (cellType == C1.WPF.FlexGrid.CellType.ColumnHeader) { var tip = string.Format("This is the tooltip for column '{0}'.", grid.Columns[range.Column].ColumnName); cell.ToolTip = tip; } return(cell); }
public override void CreateCellContent(C1.WPF.FlexGrid.C1FlexGrid grid, Border bdr, C1.WPF.FlexGrid.CellRange range) { var col = grid.Columns[range.Column]; if (col.ColumnName == "ItemImage") { // create binding var b = new Binding(); b.Path = new PropertyPath("ItemType"); b.Converter = new MyImageConverter(); // create image, bind source property using new binding var img = new Image(); img.SetBinding(Image.SourceProperty, b); // assign to cell bdr.Child = img; } else { base.CreateCellContent(grid, bdr, range); } }