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
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Views
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Collapse]Appearance and Conditional Formatting
    [Collapse]Custom Painting
      Custom Painting Basics
      Custom Painting Scenarios
      Elements that Can Be Custom Painted
      Manually Invalidating Controls
    [Expand]Alpha Blending and Background Images
    Split Presentation
    Row Preview Sections
   [Expand]Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property 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]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

Manually Invalidating Controls

The grid control automatically repaints its elements when their appearance or display information changes. For instance, the grid automatically repaints the footer panel after summary values change. In some cases, you may need to manually invoke an element's rendering.

For example, you may want to display the number of selected rows in the group panel. To do this, handle the GridView.CustomDrawFooter event. The group panel is not repainted automatically after the number of selected rows changes. Thus, you should manually invoke the group panel rendering (the GridView.InvalidateGroupPanel method) in response to row selection changes (the ColumnView.SelectionChanged event).

Consider another example, in which you need to customize cells' appearance according to an external control's state. You can specify data cells' appearance using the GridView.RowCellStyle event, and force data cells to be repainted each time the external control's state changes by calling the BaseView.LayoutChanged method.

To manually invalidate a grid element, call a dedicated invalidation method the Data Grid control provides. An invalidation method adds the region the element occupies to the control's update region. Update regions are repainted asynchronously (during the next paint operation). To force asynchronous painting, call the GridControl.Update method after calling an invalidation method.

To invalidate an entire view, use the BaseView.Invalidate method. The BaseView.InvalidateRect method allows you to repaint a specific View region. In most cases, however, you need to update particular grid elements (not the entire view). For this purpose, call one of the methods listed in the table below.

Expanded Example

The following example demonstrates how to display the number of currently selected rows in the group panel by handling the GridView.CustomDrawGroupPanel event. The group panel is not automatically repainted after the row selection changes. To resolve the issue, handle the ColumnView.SelectionChanged event and call the GridView.InvalidateGroupPanel method to invalidate the group panel and raise the GridView.CustomDrawGroupPanel event.

Expanded See Also

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