[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Collapse]Editors and Simple Controls
    Included Controls and Components
   [Expand]Common Editor Features and Concepts
   [Expand]Lookup Editors
    Popup Container Editor
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
    Templated ListBox Controls
    [Collapse]Data Binding
      How to: Bind a Standalone Editor in Code
      How to: Use CheckEdit to Display and Modify Data from Bound Data Field
     How to: Add Scrollbars for PictureBox
     How to: Add Value Entered by User to LookUpEdit's Data Source
     How to: Assign Custom Shortcut Used to Open/Close Popup Editor's Window
     How to: Change Current UI Culture
     How to: Change Item's Height in ComboBoxEdit
     How to: Change Page's Position in XtraTabControl
     How to: Control Appearance of Multiple Controls via StyleController
     How to: Copy Selected Text in TextEdit Control
     How to: Create and Place Onto Form Horizontal Scroll Bar at Runtime
     How to: Create and Populate CheckedListBoxControl at Runtime
     How to: Create ButtonEdit Control in Code
     How to: Create Column with Custom Data in LookUpEdit
     How to: Create ImageComboBoxEdit Control at Runtime
     How to: Create ListBoxControl at Runtime
     How to: Create Lookup Editor and Bind It to Data Source
     How to: Create New DataNavigator Control
     How to: Create New Vertical ScrollBar at Runtime
     How to: Create Radio Group and Respond to Value Selection
     How to: Create SimpleButton Control
     How to: Create XtraTabControl at Runtime
     How to: Custom Paint ComboBoxEdit's Items
     How to: Custom Paint ListBoxControl's Items
     How to: Customize HyperLinkEdit's Command via Event
     How to: Customize Operand Editor Properties in FilterControl
     How to: Delete ListBoxControl's Items That Include Specific Strings
     How to: Disable CheckedComboBoxEdit's Items via Event
     How to: Disable Specific Items in CheckedListBoxControl via Event
     How to: Display Custom Button Within XtraTab Control
     How to: Display Custom Controls in Popup
     How to: Display File Operation's Progress via ProgressBarControl
     How to: Display QR Bar Code in BarCodeControl
     How to: Display Set of Boolean Options in CheckedComboBoxEdit Control
     How to: Enable Opening ComboBox's Dropdown Window Based on Custom Logic
     How to: Enter date-time values
     How to: Enter numeric values
     How to: Format Text in CheckEdit Using HTML Tags
     How to: Format Text in LabelControl Using HTML Tags
     How to: Implement Custom Tooltip for TrackBarControl's Thumb
     How to: Implement Error Notifications for Custom Business Object on Data Source Level
     How to: Implement Hyperlink Functionality by Handling OpenLink Event
     How to: Paint Background of Numbers in DateEdit Using Skin Element
     How to: Paste Clipboard's Text to TextBox Control
     How to: Perform Custom Actions when End-Users Click Navigator Buttons
     How to: Prevent Displaying TextEdit Menu via BeforeShowMenu Event
     How to: Prevent Popup Window Closing for PopupContainerEdit
     How to: Remove Specific Operators from FilterControl
     How to: Respond to Changing CheckEdit's State
     How to: Respond to Checking Items in CheckedListBoxControl
     How to: Respond to Clicking ButtonEdit's Embedded Buttons
     How to: Respond to Clicking Close Button in XtraTabControl
     How to: Respond to Editor's Value Modification
     How to: Respond to Selecting ComboBoxEdit's Items
     How to: Respond to Selecting ListBoxControl's Items
     How to: Restrict User Input in Date Editor
     How to: Restrict Values Being Entered in Editors
     How to: Set Custom Height for Specific Items in ListBoxControl
     How to: Share Editors Between Multiple XtraGrid Controls
     How to: Show Array of Strings in ListBoxControl
     How to: Show Enumeration's Values in ImageComboBoxEdit Control
     How to: Show Values of Enumeration in CheckedComboBoxEdit
     How to: Supply Custom Error Icon for Editor
     How to: Use Custom Value Editor in FilterControl
     How to: Validate Data via DXValidationProvider Component
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Use CheckEdit to Display and Modify Data from Bound Data Field

This example demonstrates how to handle RepositoryItemCheckEdit.QueryCheckStateByValue and RepositoryItemCheckEdit.QueryValueByCheckState events in order to use a check editor to display and modify data from the bound data field.

The example assumes that a check editor is bound to a specific dataset field whose type is not obviously known and should be determined programmatically. The available data types that the field can take on are boolean, string and integer. So the field can contain the following combinations representing an option value (these values will be used to set the editor's CheckEdit.EditValue property):

  • True, False - for the boolean type;
  • "Yes", "No", "?" - for the string type;
  • 1, 0, -1 - for the integer type.

It is evident that making use of RepositoryItemCheckEdit.ValueChecked, RepositoryItemCheckEdit.ValueUnchecked and RepositoryItemCheckEdit.ValueGrayed properties is insufficient in this case. Thus, the example requires and implements a custom "edit value -> check state" and "check state -> edit value" conversion logic, which is illustrated by the sample code below.

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