ColumnBase.EditSettings Property
Gets or sets an object that contains the column editor’s settings. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.1.Core.dll
NuGet Package: DevExpress.Wpf.Grid.Core
Declaration
Property Value
Type | Description |
---|---|
BaseEditSettings | A BaseEditSettings descendant that specifies the column’s editor. |
Remarks
The Assign Editors to Cells topic lists alternative approaches to customization of column editors.
The GridControl automatically creates an editor for a column based on its value type. For example, if a column is bound to a DateTime field, the GridControl creates a date editor for it. If a column is bound to a numeric field, the numeric editor is used. Otherwise, the text editor is used.
Each editor has a helper class responsible for the editor’s functionality:
- BarCodeEditSettings
- CheckEditSettings
- ColorEditSettings
- ComboBoxEditSettings
- HyperlinkEditSettings
- ImageEditSettings
- ListBoxEditSettings
- PasswordBoxEditSettings
- RatingEditSettings
- SparklineEditSettings
- TextEditSettings
- CalcEditSettings
- DateEditSettings
- LookUpEditSettingsBase
- MemoEditSettings
- PopupColorEditSettings
- PopupImageEditSettings
- SpinEditSettings
- ToggleSwitchEditSettings
Use the column’s EditSettings property to specify an in-place editor for a column.
Note
The GridControl ignores EditSettings at the cell level when you define a custom CellTemplate.
The following code sample shows how to assign a spin editor to the UnitPrice column:
<dxg:GridColumn x:Name="colUnitPrice" FieldName="UnitPrice">
<dxg:GridColumn.EditSettings>
<dxe:SpinEditSettings MaxValue="999" MinValue="1" DisplayFormat="c2"/>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
When the same editor is used in multiple locations, the GridControl uses the helper class to paint its cells. The actual editors are only created when the user starts to edit a cell. When editing is completed, the editors are automatically deleted. This improves the application’s performance.
To obtain a column’s actual editor, use the ColumnBase.ActualEditSettings property. This property returns the editor’s helper class that defines the editor’s functionality and behavior.
Use the BaseEditSettings.CreateEditor method to create an editor from an EditSettings object programmatically.
Use the ValueFactoryExtension if you specify the EditSettings
property in the style applied to multiple columns:
<Window.Resources>
<Style TargetType="dxg:GridColumn" x:Key="columnStyle">
<Setter Property="EditSettings">
<Setter.Value>
<dxmvvm:ValueFactory>
<DataTemplate>
<dxe:TextEditSettings MaskType="Numeric"
Mask="c"
MaskUseAsDisplayFormat="True"/>
</DataTemplate>
</dxmvvm:ValueFactory>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<dxg:GridControl ItemsSource="{Binding Source}">
<!-- ... -->
<dxg:GridColumn FieldName="UnitPrice" Style="{StaticResource columnStyle}"/>
<dxg:GridColumn FieldName="Total" Style="{StaticResource columnStyle}"/>
</dxg:GridControl>
</Grid>
Automatic Filter Row
The EditSettings
property affects the Automatic Filter Row. Specify the CellTemplate to assign a different editor for data cells:
<dxg:GridColumn FieldName="Date">
<!-- Automatic Filter Row uses TextEdit -->
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings/>
</dxg:GridColumn.EditSettings>
<!-- Data cells use DateEdit -->
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:DateEdit x:Name="PART_Editor"/>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the EditSettings property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.