可以采用这种方法,
xaml代码如下
- <Grid>
- <c1:C1FlexGrid x:Name="grid" KeyActionTab="MoveAcrossOut" KeyActionEnter="MoveAcross" Padding="5">
- <c1:C1FlexGridFilterService.FlexGridFilter>
- <c1:C1FlexGridFilter></c1:C1FlexGridFilter>
- </c1:C1FlexGridFilterService.FlexGridFilter>
- </c1:C1FlexGrid>
- <Grid x:Name="innerGrid">
- <Grid.Resources>
- <Style TargetType="{x:Type TextBlock}">
- <Setter Property="HorizontalAlignment" Value="Center"/>
- <Setter Property="FontWeight" Value="Bold"/>
- </Style>
- </Grid.Resources>
- </Grid>
- </Grid>
复制代码
后台设置样式代码
- grid.ColumnHeaders.Resources = innerGrid.Resources;
复制代码
|