Like other posters, you commented, you need to collapse your own. Fortunately, this is not too complicated.
In my application, I need a way to draw a 16x16 icon in a specific column. I created a new class that inherits from DataGridColumnStyle, which makes it easy to apply to DataGridthrough an object DataGridTableStyle.
class DataGridIconColumn : DataGridColumnStyle {
public Icon ColumnIcon {
get;
set;
}
protected override void Paint( Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight ) {
g.FillRectangle( backBrush, bounds );
if (this.ColumnIcon != null) {
g.DrawIcon( this.ColumnIcon, bounds.X, bounds.Y );
}
}
}
, ColumnIcon, , .
, DataGrid, :
DataGridTableStyle ts = new DataGridTableStyle();
DataGridIconColumn dgic = new DataGridIconColumn();
dgic.ColumnIcon = Properties.Resources.MyIcon;
dgic.MappingName = "<your_column_name>";
dgic.HeaderText = "<your_column_header>";
ts.GridColumnStyles.Add(dgic);
this.myDataGrid.TableStyles.Add( ts );
DataGridTableStyle - DataGrid. , .