Other DevExpress WinForms Cheat Sheets
Data Grid and Grid-Based Editors
GridControl, GridLookUpEdit, and SearchLookUpEdit allow you to load data in small portions on demand, and carry out all data shaping operations on the server side. This mode is useful when you need to work with a big amount of data. To enable this mode, connect a control to the Server Mode Data Source component.
Server Mode Data Sources do not interact with the underlying data base directly. They work with a database through an intermediate layer - LINQ to SQL, Entity Framework, and other data access technologies that support an abstract API to build SQL queries dynamically.
In our online documentation, you can find a complete list of data access technologies supported at the moment - refer to the "Server Mode Data Sources" section of the Large Data Sources: Server and Instant Feedback Modes help article.
Data Grid also supports Infinite Scrolling, which allows you to implement your own data loading routine and get full control over data-related operations.
All server modes except XPServerCollectionSource are read-only. To add or remove rows, you need to use methods of an intermediate layer. To edit an object, you can create a separate edit form. The main idea is to obtain the ID of a required object, load it from the data base using the intermediate layer's method, and pass this object to the edit form. Then, post changes back to the data base when the edit form is closed. See the following KB article and examples that demonstrate how to implement this functionality for various server mode data sources:
Implementing CRUD operations in read-only data sources using XtraGrid
Scheduler
When Scheduler changes its displayed time interval, it sends requests to the DataStorage / Storage to get appointments that should be displayed. The Storage fires the FetchAppointments event and sends data queries to the underlying data source. You can handle this event to load only a small part of appointments from the data source. In this event handler, you can decrease the data loading time. To ensure best user experience when scrolling and switching between views, you can load appointments for a larger interval (for example, for the previous and next months). So, a common interval formula can be as follows:
CodeStartDate = 'current date' - 'one month';
FinishDate = 'current date' + 'one month';
You can vary this interval based on your requirements.
Tree List
If Tree List isn't required in your scenario, consider using Data Grid instead. If this isn't possible, follow this article to load data dynamically: Virtual Mode (Dynamic Data Loading) Using Events (Tree List Level).
Examples
Can I make an XPCollection that loads only those rows that should be shown?
XPCollection doesn't support this. Consider using any of the following components instead:
Which sources should I use to load data from WebAPI (WCF and OData data services)?
For WCF and OData data services, we offer the following server mode data sources: