New to Telerik UI for WinUI? Download free 30-day trial

DataBindingComplete Command

The DataBindingComplete command provides an MVVM-friendly implementation of the DataBindingComplete event. This event is useful when some logic needs to be executed after the data view is generated. Since the DataGrid provides a multi-threaded implementation of all the in-memory data operations like grouping, sorting, and filtering, the DataBindingComplete event is the safe entry point which grants that all the data-related operations are successfully completed and the data view can be accessed and manipulated.

Execution Parameter

The execution parameter is of type DataBindingCompleteEventArgs and exposes the following properties:

  • DataView—Gets the Telerik.UI.Xaml.Controls.Grid.IDataView implementation that allows for traversing and/or manipulating the already computed data View.
  • ChangeFlags—Gets the flags that triggered the re-evaluation of the underlying raw data. The possible flags are DataChangeFlags.Group, DataChangeFlags.Sort, and DataChangeFlags.Filter.

Custom DataBindingComplete Command

The following examples show how to create a class that inherits from the DataGridCommand and add it to the Commands collection.

Create a Custom DataBindingComplete Command

public class CustomDataBindingCompleteCommand : DataGridCommand 
{ 
    public CustomDataBindingCompleteCommand() 
    { 
        this.Id = CommandId.DataBindingComplete; 
    } 
 
    public override bool CanExecute(object parameter) 
    { 
        var context = parameter as DataBindingCompleteEventArgs; 
        // put your custom logic here 
        return true; 
    } 
 
    public override void Execute(object parameter) 
    { 
        var context = parameter as DataBindingCompleteEventArgs; 
        // put your custom logic here        
 
        this.Owner.CommandService.ExecuteDefaultCommand(CommandId.DataBindingComplete, context);         
    } 
} 

Add the Custom Command to the Commands Collection

<Grid xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid"> 
    <grid:RadDataGrid Width="600" Height="460" x:Name="grid" Hold> 
        <grid:RadDataGrid.Commands> 
            <local:CustomDataBindingCompleteCommand/> 
        </grid:RadDataGrid.Commands> 
    </grid:RadDataGrid> 
</Grid> 

See Also

In this article
Not finding the help you need?