Class CellFormat
Represents the CellFormat class.
Namespace: Syncfusion.Windows.Controls.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.WPF.dll
Syntax
public sealed class CellFormat : BaseNodeConstructors
CellFormat()
Initializes a new instance of the CellFormat class.
Declaration
public CellFormat()CellFormat(BaseNode)
Initializes a new instance of the CellFormat class for the specified BaseNode.
Declaration
public CellFormat(BaseNode owner)Parameters
| Type | Name | Description | 
|---|---|---|
| BaseNode | owner | The owner of the CellFormat. The value can be null or an instance of TableCellAdv. | 
Fields
BackgroundProperty
Identifies the Background dependency property.
Declaration
[Obsolete("This property has been deprecated. Use Shading.Background property for cell background")]
public static readonly DependencyProperty BackgroundPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the Background dependency property. | 
BordersProperty
Identifies the Borders dependency property.
Declaration
public static readonly DependencyProperty BordersPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the Borders dependency property. | 
BottomMarginProperty
Identifies the BottomMargin dependency property.
Declaration
public static readonly DependencyProperty BottomMarginPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the BottomMargin dependency property. | 
CellMarginProperty
Identifies the CellMargin dependency property.
Declaration
[Obsolete("This property has been deprecated. Use LeftMargin, RightMargin, TopMargin, BottomMargin properties to set the cell margins.")]
public static readonly DependencyProperty CellMarginPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the CellMargin dependency property. | 
CellWidthProperty
Identifies the CellWidth dependency property.
Declaration
public static readonly DependencyProperty CellWidthPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the CellWidth dependency property. | 
ColumnSpanProperty
Identifies the ColumnSpan dependency property.
Declaration
public static readonly DependencyProperty ColumnSpanPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the ColumnSpan dependency property. | 
LeftMarginProperty
Identifies the LeftMargin dependency property.
Declaration
public static readonly DependencyProperty LeftMarginPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the LeftMargin dependency property. | 
PreferredWidthProperty
Identifies the PreferredWidth dependency property.
Declaration
public static readonly DependencyProperty PreferredWidthPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The idntifies for the PreferredWidth depenedency property. | 
PreferredWidthTypeProperty
Identifies the PreferredWidthType dependency property.
Declaration
public static readonly DependencyProperty PreferredWidthTypePropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the PreferredWidthType dependency property. | 
RightMarginProperty
Identifies the RightMargin dependency property.
Declaration
public static readonly DependencyProperty RightMarginPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the RightMargin dependency property. | 
RowSpanProperty
Identifies the RowSpan dependency property.
Declaration
public static readonly DependencyProperty RowSpanPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the RowSpan dependency property. | 
ShadingProperty
Identifies the Shading dependency property.
Declaration
public static readonly DependencyProperty ShadingPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the Shading dependency property. | 
TopMarginProperty
Identifies the TopMargin dependency property.
Declaration
public static readonly DependencyProperty TopMarginPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the TopMargin dependency property. | 
VerticalAlignmentProperty
Identifies the VerticalAlignment dependency property.
Declaration
public static readonly DependencyProperty VerticalAlignmentPropertyField Value
| Type | Description | 
|---|---|
| System.Windows.DependencyProperty | The identifier for the VerticalAlignment dependency property. | 
Properties
Background
Gets or sets a color that provides the background of the TableCellAdv.
Declaration
[Obsolete("This property has been deprecated. Use Shading.Background property for cell background")]
public Color Background { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Windows.Media.Color | The color that provides the background of the TableCellAdv. Default color is empty (#00000000). | 
Examples
The following code example demonstrates how to define background color for a table cell.
<!-- Defines a table cell with background color as Green. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat Background="#FF00FF00"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell with background color as Green.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.Background = Color.FromArgb(0xFF, 0x00, 0xFF, 0x00);
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell with background color as Green.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.Background = Color.FromArgb(&HFF, &H0, &HFF, &H0)
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Borders
Gets or sets the Borders of the TableCellAdv.
Declaration
public Borders Borders { get; set; }Property Value
| Type | Description | 
|---|---|
| Borders | The borders of the TableCellAdv | 
Examples
The following code example demonstrates how to define borders of the table cell.
<!-- Defines the borders of the table cell. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat>
        <RichTextBoxAdv:CellFormat.Borders>
        <RichTextBoxAdv:Borders>
        <RichTextBoxAdv:Borders.Left>
        <RichTextBoxAdv:Border LineStyle="Single"/>
        </RichTextBoxAdv:Borders.Left>
        </RichTextBoxAdv:Borders>
        </RichTextBoxAdv:CellFormat.Borders>
        </RichTextBoxAdv:CellFormat>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the borders of the table cell. --> 
</RichTextBoxAdv:TableCellAdv> // Defines the borders of the table cell.
 TableCellAdv tableCell = new TableCellAdv();
 CellFormat cellFormat = new CellFormat();
 Borders borders = new Borders();
 Border left = new Border();
 left.LineStyle = LineStyle.Single;
 borders.Left = left;
 cellFormat.Borders = borders;
 tableCell.CellFormat = cellFormat;
 // Defines the borders of the table cell.' Defines the borders of the table cell.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
Dim borders As New Borders()
Dim left As New Border()
left.LineStyle = LineStyle.[Single]
borders.Left = left
cellFormat.Borders = borders
tableCell.CellFormat = cellFormat
'Defines the borders of the table cell.BottomMargin
Gets or sets the bottom margin of the TableCellAdv.
Declaration
public double BottomMargin { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | The bottom margin of the TableCellAdv. | 
Examples
The following code example demonstrates how to define bottom margin for a table cell.
<!-- Defines a table cell with bottom margin as 4 pixels. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat BottomMargin="4"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell with bottom margin as 4 pixels.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.BottomMargin = 4;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell with bottom margin as 4 pixels.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.BottomMargin = 4
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | The measuremnet must be between 0 px and 2112px px. | 
CellMargin
Gets or sets the margin of the TableCellAdv.
Declaration
[Obsolete("This property has been deprecated. Use LeftMargin, RightMargin, TopMargin, BottomMargin properties to set the cell margins.")]
public Thickness CellMargin { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Windows.Thickness | The margin of the TableCellAdv. | 
CellWidth
Gets or sets the width of the TableCellAdv.
Declaration
public double CellWidth { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | The width of the TableCellAdv. | 
Examples
The following code example demonstrates how to define width for a table cell.
<!-- Defines a table cell of width as 300 pixels. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat CellWidth="300"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell of width as 300 pixels.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.CellWidth = 300;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell of width as 300 pixels.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.CellWidth = 300
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.ColumnSpan
Gets or sets the number of columns that the TableCellAdv should span.
Declaration
public int ColumnSpan { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | The number of columns that the TableCellAdv should span. | 
Examples
The following code example demonstrates how to define a table cell to span horizontally across multiple columns.
<!-- Defines a table cell that spans horizontally across two columns. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat ColumnSpan="2"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell that spans horizontally across two columns.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.ColumnSpan = 2;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell that spans horizontally across two columns.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.ColumnSpan = 2
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | ColumnSpan value must be greater than or equal to one. | 
LeftMargin
Gets or sets the left margin of the TableCellAdv.
Declaration
public double LeftMargin { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | The left margin of the TableCellAdv. | 
Examples
The following code example demonstrates how to define left margin for a table cell.
<!-- Defines a table cell with left margin as 6 pixels. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat LeftMargin="6"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell with left margin as 6 pixels.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.LeftMargin = 6;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell with left margin as 6 pixels.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.LeftMargin = 6
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | The measurement must be between 0 px and 2112px px. | 
PreferredWidth
Gets or sets the preferred width of the TableCellAdv.
Declaration
public double PreferredWidth { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | The preferred width of the TableCellAdv | 
Examples
The following code example demonstrates how to define preferred width for the table cell.
<!-- Defines the preferred width for the table cell. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat PreferredWidthType = "Pixel"  PreferredWidth = "500"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the preferred width of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines the preferred width of the table cell.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.PreferredWidthType = WidthType.Pixel;
CellFormat.PreferredWidth = 500;
tableCell.CellFormat = cellFormat;
// Define the preferred width of the table cell.' Defines the preferred width of the table cell.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.PreferredWidthType = WidthType.Pixel
CellFormat.PreferredWidth = 500
tableCell.CellFormat = cellFormat
'  Define the preferred width of the table cell.PreferredWidthType
Gets or sets the WidthType of the TableCellAdv
Declaration
public WidthType PreferredWidthType { get; set; }Property Value
| Type | Description | 
|---|---|
| WidthType | The preferred width type of the TableCellAdv | 
Examples
The following code example demonstrates how to define preferred width type for the table cell.
<!-- Defines the preferred width type for the table cell. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat PreferredWidthType = "Pixel"  PreferredWidth = "500"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the preferred width type of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines the preferred width type of the table cell.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.PreferredWidthType = WidthType.Pixel;
CellFormat.PreferredWidth = 500;
tableCell.CellFormat = cellFormat;
// Define the preferred width type of the table cell.' Defines the preferred width type of the table cell.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.PreferredWidthType = WidthType.Pixel
CellFormat.PreferredWidth = 500
tableCell.CellFormat = cellFormat
'  Define the preferred width type of the table cell.RightMargin
Gets or sets the right margin of the TableCellAdv.
Declaration
public double RightMargin { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | The right margin of the TableCellAdv. | 
Examples
The following code example demonstrates how to define right margin for a table cell.
<!-- Defines a table cell with right margin as 4 pixels. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat RightMargin="4"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell with right margin as 4 pixels.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.RightMargin = 4;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell with right margin as 4 pixels.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.RightMargin = 4
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | The measurement must be between 0 px and 2112px px. | 
RowSpan
Gets or sets the number of rows that the TableCellAdv should span.
Declaration
public int RowSpan { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | The number of rows that the TableCellAdv should span. | 
Examples
The following code example demonstrates how to define a table cell to span vertically across multiple rows.
<!-- Defines a table cell that spans vertically across four rows. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat RowSpan="4"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell that spans vertically across four rows.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.RowSpan = 4;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell that spans vertically across four rows.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.RowSpan = 4
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | RowSpan value must be greater than or equal to one. | 
Shading
Declaration
public Shading Shading { get; set; }Property Value
| Type | 
|---|
| Shading | 
TopMargin
Gets or sets the top margin of the TableCellAdv.
Declaration
public double TopMargin { get; set; }Property Value
| Type | Description | 
|---|---|
| System.Double | The top margin of the TableCellAdv. | 
Examples
The following code example demonstrates how to define top margin for a table cell.
<!-- Defines a table cell with bottom margin as 6 pixels. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat TopMargin="6"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the blocks of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines a table cell with bottom margin as 6 pixels.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.TopMargin = 6;
tableCell.CellFormat = cellFormat;
// Define the blocks of the table cell.' Defines a table cell with top margin as 6 pixels.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.ToplMargin = 6
tableCell.CellFormat = cellFormat
' Define the blocks of the table cell.Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentOutOfRangeException | The measurement must be between 0 px and 2112px px. | 
VerticalAlignment
Gets or sets the CellVerticalAlignment of the TableCellAdv.
Declaration
public CellVerticalAlignment VerticalAlignment { get; set; }Property Value
| Type | Description | 
|---|---|
| CellVerticalAlignment | The cell vertical alignment of the TableCellAdv | 
Examples
The following code example demonstrates how to define the vertical alignment of the table cell.
<!-- Defines the vertical alignment of the table cell. --> 
<RichTextBoxAdv:TableCellAdv>
    <RichTextBoxAdv:TableCellAdv.CellFormat>
        <RichTextBoxAdv:CellFormat VerticalAlignment="Center"/>
    </RichTextBoxAdv:TableCellAdv.CellFormat>
    <!-- Define the vertical alignment of the table cell. --> 
</RichTextBoxAdv:TableCellAdv>// Defines the vertical alignment of the table cell.
TableCellAdv tableCell = new TableCellAdv();
CellFormat cellFormat = new CellFormat();
cellFormat.VerticalAlignment = CellVerticalAlignment.Center;
tableCell.CellFormat = cellFormat;
// Define the vertical alignment of the table cell.' Defines the vertical alignment of the table cell.
Dim tableCell As New TableCellAdv()
Dim cellFormat As New CellFormat()
cellFormat.VerticalAlignment = CellVerticalAlignment.Center
tableCell.CellFormat = cellFormat
' Define the vertcal alignment of the table cell.