Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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
    Templated ListBox Items
   [Collapse]Simple Editors
    [Expand]Included Components
    [Expand]Editors Structure
    [Collapse]Editors Features
      Text Editing Overview
     [Expand]Mask Editors Overview
     [Collapse]Formatting and Parsing Values
       Formatting
     [Expand]Editor Buttons Overview
     [Expand]Dropdown Editors Overview
      Image Editing Menu
     [Expand]Data Binding Overview
     [Expand]Appearance Customization
     [Expand]Miscellaneous Features
    [Expand]Member Tables
    [Expand]Examples
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Formatting and Parsing Values

Expanded Formatting

Each editor presents its data (edit value) in a specific manner (as a string, picture, check box, etc.). For a standalone editor, its edit value can be set and read using the editor's BaseEdit.EditValue property (this property is bindable). For editors embedded into container controls (e.g., GridControl, and TreeList), the editor's value is provided by the parent container control. For instance, when an editor is embedded in a GridControl's cell, the grid supplies data to the editor by obtaining it from an underlying data source.

When an edit value is about to be displayed onscreen by the editor, the formatting mechanism is invoked, which translates the edit value into the display value (or display text for text editors).

Before the default formatting mechanism is invoked, you can substitute the edit value with another one by handling the editor's FormatEditValue event (RepositoryItem.FormatEditValue or BaseEdit.FormatEditValue; the latter is only available for standalone editors). After your event handler is complete, the new value will be formatted using the default formatting mechanism.

To customize display formatting settings of editors, use the RepositoryItem.DisplayFormat property. See Formatting to learn more.

To enable masked input, use the RepositoryItemTextEdit.Mask property. More information is available in Mask Editors Overview.

Expanded Parsing

Each time an end-user accepts an edit value or a new value is assigned to the editor in code, the input value is converted to the editor's data type (numeric, date-time, etc.). For instance, this occurs when the editor is about to lose focus when the ENTER key is pressed (if the RepositoryItemTextEdit.ValidateOnEnterKey property value is true) or when a value is assigned to the BaseEdit.EditValue property in code. You can override the default conversion by handling the RepositoryItem.ParseEditValue event.

Expanded Formatting and Parsing Values in Data Bound Editors

Data bound editors obtain their values by reading them from a data source, and save modified data by positing it back to the data source. To replace values transferred from a data source to bound editors, handle the System.Windows.Forms.Binding.Format event. To replace values transferred from bound editors to the data source, handle the System.Windows.Forms.Binding.Parse event.

How would you rate this topic?​​​​​​​