Skip to main content

Custom Edit Template

Cell values are represented and edited using editors that ship with the DXEditors for Silverlight library. If none of these editors meets your requirements, you can use custom editors. Each column provides two templates that allow you to define custom editors that display (when the grid is in browse mode) and/or edit (when the grid is in edit mode) column values.

Method Description
ColumnBase.DisplayTemplate Defines a template that displays cell values.
ColumnBase.EditTemplate Defines a template that represents an editor used to edit cell values.
ColumnBase.CellTemplate Defines a presentation of column cells (display and edit values).
NOTE

The Name property of a control used to edit cell values, must be set to "PART_Editor".


<dxg:GridColumn FieldName="UnitPrice">
    <dxg:GridColumn.DisplayTemplate>
        <ControlTemplate>
            <ProgressBar Value="{Binding Path=DisplayText, Mode=OneWay,
                                RelativeSource={RelativeSource TemplatedParent}}"
            Minimum="0" Maximum="50"/>
        </ControlTemplate>
    </dxg:GridColumn.DisplayTemplate>
    <dxg:GridColumn.EditTemplate>
        <ControlTemplate>
            <dxe:SpinEdit x:Name="PART_Editor" Value="{Binding EditValue, Mode=TwoWay}"/>
        </ControlTemplate>
    </dxg:GridColumn.EditTemplate>
</dxg:GridColumn>

For the complete example, see How to: Use Custom Editors to Edit Cell Values .