Represents a cell

Namespace: Dapfor.Wpf.Controls
Assembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: (


public sealed class Cell
Visual Basic
Public NotInheritable Class Cell
Visual C++
public ref class Cell sealed
type Cell =  class end


The most common operations with cells include updating, determining location, blinking and some others:

 Copy imageCopy
public void MostCommonOperationsWithCell(GridControl grid)
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Price"));
    grid.Headers[0].Add(new Column("Quantity"));
    grid.Rows.Add(new Product());
    Row row = grid.Rows[0];

    //Set a new price programmatically
    Cell cell = row["Price"];
    cell.Value = 52.32;
    //Edit cell with an appropriate editor
    grid.Headers[0]["Price"].Editable = true;

    //Blink cell with the red brush for 2 seconds
    cell.Blink(new TimeSpan(0, 0, 2), Brushes.Red);
    //Ensure cell visible
    //Force the grid to resort the row and verify if the row should be filtered. I.e. if the IFilter.IsFiltered(row) returns true.
    //Normally this method is called automatically, if the data object implements INotifyPropertyChanged interface.
    //Just invalidate cell i.e. ask the grid to repaint cell without cheching for the position 
    //in the sorted order and checking if the row is filtered.

Cell templatization enables usage of any controls in grid cells via data templates. Templates are usually defined as resources in XAML files. To use a template, it should be set in the required grid column.

Cell data templates enable simple binding to cell content. For this purpose an object of Cell type is transferred as Content. This object has many useful properties including Cell.Text can be used for displaying text.

An object of Cell type has Cell.Value property that can be used to get unformatted values of data objects. These values can be used in cell data templates via converters.

 Copy imageCopy
<!-- Resources --> 
  <TestApplication:MyCollection x:Key="someCollection" /> 
  <TestApplication:IntToFlagValueConverter x:Key="intToFlagConverter"/> 
  <DataTemplate x:Key="cellTemplate"> 
      <Image Source="{Binding Path=Value, Converter={StaticResource intToFlagConverter}}"/> 
      <Grid Grid.Column="1"> 
        <Ellipse Fill="Green"/> 
        <TextBlock Text="{Binding Path=Text}" HorizontalAlignment="Center" Foreground="Red"/> 
        <ColumnDefinition Width="Auto"/> 

<!-- GridControl declaration --> 
<df:GridControl Name="grid"> 
      <df:Column Id="Value1" Title="Column 0" CellTemplate="{StaticResource cellTemplate}" Width="100" /> 
      <df:Column Id="Value2" Title="Column 1" Width="100" /> 

Inheritance Hierarchy


See Also