FlexGrid for WPF | ComponentOne
C1.WPF.FlexGrid.4.6.2 Assembly / C1.WPF.FlexGrid Namespace / RowCol Class / CellStyle Property
Example

In This Topic
    CellStyle Property (RowCol)
    In This Topic
    Gets or sets a CellStyle that defines the appearance of the cells in this row or column.
    Syntax
    'Declaration
     
    Public Property CellStyle As CellStyle
    public CellStyle CellStyle {get; set;}
    Remarks
    This property allows you to define reusable styles for grid rows and columns. You can easily create CellStyle objects in XAML or in code, and then assign them to grid rows or columns.
    Example
    The XAML snippet below defines two CellStyle objects and applies them to a column:
    <Grid.Resources>
      <c1:CellStyle x:Key="redStyle" 
        Background="Red" Foreground="White"
        FontWeight="Bold" HorizontalAlignment="Center" />
      <c1:CellStyle x:Key="blueStyle" 
        Background="Blue" Foreground="White" FontStyle="Italic"
        HorizontalAlignment="Center" VerticalAlignment="Center" />
    </Grid.Resources>
                
    <c1:C1FlexGrid Name="_flex" >
      <c1:C1FlexGrid.Columns>
        <c1:Column 
          Header="Hello"
          HeaderCellStyle="{StaticResource redStyle}" 
          CellStyle="{StaticResource blueStyle}" />
       </c1:C1FlexGrid.Columns>
       <c1:C1FlexGrid.Rows>
         <c1:Row/>
         <c1:Row/>
       </c1:C1FlexGrid.Rows>
     </c1:C1FlexGrid>
    See Also