we expect to ship our next major update version 20.1 in May 2020 among new WPF specific
features we'll include in this update is data editing support for our WPF grids
virtual data source as I'll demonstrate shortly data editing support for our
grids virtual data source will be available at the row level if you're
using an infinite or a paged virtual data source your end-users will be able
to modify row data and post changes to the underlying data source
asynchronously before I start a quick word for those
who are new to our WPF data grid our WPF grid allows you to bind data to any data
source even when the total record count is unknown unlike a more traditional
data source when you bind our grid to a virtual data source the control only
requests top records or a specific page of records in previous versions data
editing was unavailable due to the virtual nature of the data source well
as you can obviously tell this limitation no longer exists
we now fully support data editing for virtual data sources the DevExpress WPF
data grid ships with an unbelievably rich data editing library from date
selectors to advanced drop-down controls we'll discuss our industry-leading cell
editing options in a future video but for now let's get into it and show you
how you can edit virtual data source records to help demonstrate this feature
I'll use a sample that's currently available on our github page you'll find
a link to the sample in the video's description in this github sample our
WPF data grid already uses a virtual data source as you can see it connects
to a class that imitates a web service and implements basic data operations
such as sorting and filtering to enable data editing for this sample I'll need
to modify the issue data class and make its property setters public next I'll
have to add a new method to our service class to save changes m ade in our data
grid this method will be asynchronous this will help prevent UI lock ups
during save operations once I've added the service class method I'll specify
the fields that can be edited at run time I'm going to find my priority
column in XAML and set its allow editing property to true
I will also configure our WPF data grids table view to display update and cancel
buttons during row edit operations before I continue I do want to quickly
mention that our WPF data grid ships with a view based architecture if you've
used our grid in the past you'll know that the control ships with three view
options tables, cards and tree lists virtual data source editing is currently
available for our grids table view okay with those simple changes to the github
sample I'm ready to run the project and view my results as you can see the
priority column is now editable notice that if I make a change to a record and
then press the Update button nothing actually happens the reason for this is
simple our changes are in memory but haven't been passed to the web service
let me close the running app and return to my project this time I'm going to add
a handler for the validate row in my grids table view
in the event handler I can call the update row async method to save changes
as you can see the update row result property accepts a task that allows you
to work with asynchronous methods if we run the app
and press update the data grid will call our web service method and display a
wait indicator symbol while it awaits service results
before I wrap up this tutorial I want to show you how to easily add validation
rules to this github sample I can do this directly in the validate row method
but I'm going to add my validation rule in the samples service class instead
I'll do this to demonstrate the ease with which our WPF data grid handles
server-side errors it's really quite amazing I'll add a simple check to
update the row async method and throw an exception for the subject field if the
subject field is empty as you may recall we only enable data editing for the
priority column so the final step is to return to the data grid and enable data
editing for the subject field I'll run the app once more and edit the
subject field I'm going to delete the contents of the row and press update
note that my exception message appears on screen this validation rule requires
that I add a value to the subject field I'll go ahead and do that so I can leave
the modified row I'll enter a character into the subject field and press update
again as you can see our WPF data grid automatically handles exceptions from
the validate row event handler and does not cancel editing unless it receives a
positive response from the webservice very cool and that's it for this video I
hope you've enjoyed this short tutorial on the DevExpress WPF grid and its
editing options for virtual data sources if you like this video please give us a
thumbs up if you have questions please comment below and please remember to
subscribe to this channel for more great DevExpress training videos