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
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Collapse]Appearance and Conditional Formatting
    [Expand]Look and Feel
    [Expand]Appearances
    [Expand]Conditional Formats
    [Collapse]Custom Painting
      Custom Painting Basics
      Tutorial: Custom Drawing
      Custom Painting Scenarios
      Elements that Can Be Custom Painted
      Manually Invalidating Controls
    [Expand]Alpha Blending and Background Images
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]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]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]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]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Manually Invalidating Controls

Expanded Manually Invalidating Controls

The grid control automatically repaints its elements when their appearance or display information has been changed. For instance, the footer panel is automatically repainted after its appearance settings have been changed or the summary values updated. In some cases, however, you may need to implement custom control behavior - display custom information within a View's elements or customize a control's appearance. Consider the following examples.

  • Assume that you need to display the number of selected rows in the View footer. To do this you should handle the GridView.CustomDrawFooter event. Note however, that the footer will not be repainted automatically after the number of selected rows has been changed. Thus, you should handle the ColumnView.SelectionChanged event to invalidate the View's footer.
  • Assume that you need to customize the appearance of cells according to the state of external controls (selection of a check box or list box control). You will specify the appearance of data cells using the GridView.RowCellStyle event. However, to force data cells to be repainted each time the external control's state is changed, you need to call the BaseView.LayoutChanged method.

To manually invalidate a control, call the control's appropriate invalidation method. All such methods add a corresponding region to the control's update region, which will be repainted during the next paint operation. To force a synchronous paint, you should call the GridControl.Update method after calling an invalidation method.

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

 

The following example code demonstrates how to custom paint the View footer so that it displays the number of currently selected rows. For this purpose the GridView.CustomDrawFooter event is handled. Note, however, that the footer will not be repainted automatically after the number of selected rows has been changed. You should handle the ColumnView.SelectionChanged event to call the GridView.InvalidateFooter method. This invalidates the View's footer.

The image below shows the result.

Expanded See Also

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