回复 1楼shayne的帖子
试试设置一下ColumnHeader的属性:
- yourFlexGrid.ColumnHeaders.Rows[0].Height = 50;
- HeaderTextWrapping=true
复制代码
另外有一个参考的代码:
- public partial class MainPage : UserControl
- {
- public MainPage()
- {
- InitializeComponent();
- this.c1FlexGrid1.Columns[0].TextWrapping = true;
-
- this.c1FlexGrid1.Columns[0].Header = "This is a long Text for column Header and too good solution";
- this.c1FlexGrid1.Columns[0].HeaderTextWrapping = true;
-
- this.c1FlexGrid1.CellFactory = new MyCellFactory();
-
- }
- }
-
- public class MyCellFactory:C1.Silverlight.FlexGrid.CellFactory
- {
- C1.Silverlight.FlexGrid.C1FlexGrid mainGrid;
- TextBlock updatedTextBlock;
- public override void CreateColumnHeaderContent(C1.Silverlight.FlexGrid.C1FlexGrid grid, Border bdr, C1.Silverlight.FlexGrid.CellRange rng)
- {
- base.CreateColumnHeaderContent(grid, bdr, rng);
-
- if (mainGrid == null)
- mainGrid = grid;
-
- if (grid.Columns[rng.Column].HeaderTextWrapping == true)
- {
- updatedTextBlock = (bdr.Child as TextBlock);
- (bdr.Child as TextBlock).LayoutUpdated += new EventHandler(MyCellFactory_LayoutUpdated);
- }
- }
-
- void MyCellFactory_LayoutUpdated(object sender, EventArgs e)
- {
- if (updatedTextBlock.Text != "")
- mainGrid.ColumnHeaders.Rows[0].Height = updatedTextBlock.ActualHeight;
- }
- }
复制代码
更多内容,请参考WPF的资源置顶帖--看看在线C1FlexGrid技术文档。 |