Posted 5 September 2019, 12:28 am EST
Hello John,
To format FlexGrid’s column header to show long header text, you can use a custom CellFactory and override its CreateColumnHeaderContent method to wrap the header textblock as follows:```
public class MyFactory : CellFactory
{
public MyFactory() { }
public override void CreateColumnHeaderContent(C1FlexGrid grid, Border bdr, CellRange rng)
{
base.CreateColumnHeaderContent(grid, bdr, rng);
var header = ((FrameworkElement)(bdr.Child as Grid).Children[0]) as TextBlock;
header.TextWrapping = TextWrapping.Wrap;
}
}
Additionally, you need to change the ColumnHeader row height as well```
private void Page_Loaded(object sender, RoutedEventArgs e)
{
_grid.ItemsSource = _view;
_grid.CellFactory = new MyFactory();
_grid.ColumnHeaders.Rows[0].Height = 100;
}
```I've also attached a simple application to demonstrate the whole code.
Bets wishes,
Ruchir
[zip filename="Wrap_ColumnHeader.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-7c2ef5d3-4879-43a9-967d-89ab7f396530.zip[/zip]