回复 5楼visualmaster的帖子
Header属性的binding它不是一个dependency property.
如果你想自定义或是bind它,可以使用CellFactory功能。
你可以设置一个TextBlock 绑定到类然后把它设置给Header的content。
举个例子:
- public partial class MainPage : UserControl
- {
- public MainPage()
- {
- InitializeComponent();
- c1flexgrid1.CellFactory = new MyCellFactory();
- }
- }
- public class MyCellFactory:C1.Silverlight.FlexGrid.CellFactory
- {
- public override void CreateColumnHeaderContent(C1.Silverlight.FlexGrid.C1FlexGrid grid, Border bdr, C1.Silverlight.FlexGrid.CellRange range)
- {
- base.CreateColumnHeaderContent(grid, bdr, range);
- TextBlock tb = new TextBlock();
- Binding Bd = new Binding();
- Bd.Path = new PropertyPath("ColumnName");
- tb.SetBinding(TextBlock.TextProperty, Bd);
- bdr.Child = tb;
- }
- }
复制代码 |