private void InitializePanel() { _cellPanel = new FlexGridPanel(this, CellType.Cell, Consts.ROWHEIGHT, Consts.COLUMNWIDTH); _columnHeaderPanel = new FlexGridPanel(this, CellType.ColumnHeader, Consts.ROWHEIGHT, Consts.COLUMNWIDTH); _columnHeaderPanel.Columns = _cellPanel.Columns; _columnHeaderPanel.Rows.Add(new Row()); }
internal RowCols(FlexGridPanel panel, int defaultSize) { _panel = panel; _defSize = defaultSize; }
internal FrameworkElement CreateCell(FlexGridPanel flexGridPanel, CellRange rng) { throw new NotImplementedException(); }
internal void DisposeCell(FlexGridPanel flexGridPanel, FrameworkElement value) { throw new NotImplementedException(); }
internal Rows(FlexGridPanel panel, int defaultSize) : base(panel, defaultSize) { }
internal Columns(FlexGridPanel panel, int defaultSize) : base(panel, defaultSize) { }
void CreateCellContent(FlexGrid grid, FlexGridPanel panel, Border bdr, CellRange rng) { // get row and column var r = panel.Rows[rng.Row]; var c = panel.Columns[rng.Column]; //var gr = r as GroupRow; // honor user templates (if the row has a backing data item) if (r.DataItem != null && c.CellTemplate != null && panel.CellType == CellType.Cell) { bdr.Padding = GetTemplatePadding(bdr.Padding); bdr.Child = GetTemplatedCell(grid, c.CellTemplate); return; } // get binding, unbound value for the cell var b = r.DataItem != null ? c.Binding : null; //var ubVal = r.DataItem != null ? null : panel[rng.Row, rng.Column]; // get foreground brush taking selected state into account var fore = GetForegroundBrush(grid, r, rng, grid.Foreground); // handle non-text types var type = c.DataType; TextBlock tb = null; CheckBox chk = null; if ( // not a group, or hierarchical panel.CellType == CellType.Cell && (type == typeof(bool) || type == typeof(bool?))) // and bool { // Boolean cells: use CheckBox chk = new CheckBox(); chk.IsThreeState = type == typeof(bool?); chk.HorizontalAlignment = HorizontalAlignment.Center; chk.VerticalAlignment = VerticalAlignment.Center; chk.MinWidth = 32; chk.HorizontalAlignment = HorizontalAlignment.Stretch; chk.VerticalAlignment = VerticalAlignment.Stretch; chk.Margin = new Thickness(0, -10, 0, -10); chk.IsHitTestVisible = false; chk.IsTabStop = false; if (fore != null) { chk.Foreground = fore; } bdr.Child = chk; if (b != null) { chk.SetBinding(CheckBox.IsCheckedProperty, b); } else { // var value = ubVal as bool?; //chk.IsChecked = value; } } else { // use TextBlock for everything else (even empty cells) tb = new TextBlock(); tb.VerticalAlignment = VerticalAlignment.Center; if (fore != null) { tb.Foreground = fore; } bdr.Child = tb; // bound values if (b != null) { // apply binding tb.SetBinding(TextBlock.TextProperty, b); } //else if (ubVal != null) // unbound values //{ // // get column format from column and/or binding // tb.Text = r.GetDataFormatted(c); //} } }
public virtual Thickness GetCellPadding(FlexGrid grid, FlexGridPanel panel, CellRange rng) { var p = _padding; return(p); }