[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Collapse]Data Editing and Validation
     Data Editing Overview
     Edit Form
     New Item Row
    [Collapse]Inplace Editors
      Inplace Editors Overview
      Assigning Editors to Columns
      Showing and Hiding Editors
      Custom Edit Template
    [Expand]Input Validation
    [Expand]Editing in Code
    [Expand]Clipboard Management
     Moving Nodes in TreeList
   [Expand]Grouping
   [Expand]Selection
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Drag-and-Drop
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Showing and Hiding Editors

Note

End-users can invoke cell editors and change cell values if the view's DataViewBase.AllowEditing property is set to true and the DataViewBase.NavigationStyle property is set to GridViewNavigationStyle.Cell.

 

End-users can switch the grid to edit mode by clicking the required cell or pressing the ENTER or F2 key. This activates the focused cell's inplace editor, allowing a user to modify the focused cell's value. To save the changes made and close the editor, an end-user should press ENTER, or move cell focus to another cell. Pressing ESC closes the editor, discarding all the changes made.

Cell editors can also be activated and closed in code.

Expanded Showing Editors

To programmatically activate the cell's editor, you should focus the cell and call the DataViewBase.ShowEditor method. This method raises the GridViewBase.ShowingEditor event, allowing you to prevent showing editors for individual cells, thus preventing their values from being edited. After the editor has been shown, a View fires the GridViewBase.ShownEditor event.

This example shows how to prevent end-users from editing values of individual cells. In this example, end-users are not allowed to change a product's Price, if the product is discontinued.

For information on how to move cell and row focus, see Focusing Cells and Moving Row Focus.

Expanded Hiding Editors

There two methods that hide the active editor. The DataViewBase.CloseEditor method hides the active editor, saving the changes made. The DataViewBase.HideEditor method hides the active editor and discards the changes. To save changes to a data source without closing the active editor, use the DataViewBase.PostEditor method.

Before the active editor's new value is posted to a data source, it is validated. If a new value is valid, it is posted to a data source and the editor can be closed. Otherwise, if a new value is invalid, the active editor cannot be closed, and cell focus cannot be moved to another cell until its value is corrected. To learn more, see Cell Validation.

After the editor has been closed, a View fires the GridViewBase.HiddenEditor event.

Is this topic helpful?​​​​​​​