WPF Data Grid – Bind to a gRPC Service

WPF Team Blog
24 June 2021
As you probably know, the DevExpress WPF Data Grid can be bound to a gRPC service. gRPC is a modern, high-performance remote procedure call (RPC) framework that can run on any platform. Our Virtual Sources allow you to connect to a gRPC service easily.
In this post, we'll describe how to connect to a gRPC service and use our Virtual Sources to display gRPC data within the WPF Grid control.
To connect to a gRPC service, you must first create a client object to access service methods:
  1. Specify the channel that connects to a gRPC service.
  2. Pass this channel as an argument to a new instance of the IssuesService.IssuesServiceClient class:
Channel channel;
IssuesService.IssuesServiceClient client;
public IssueServiceViewModel() {
    channel = new Channel("", ChannelCredentials.Insecure);
    client = new IssuesService.IssuesServiceClient(channel);
    // ...

public void Closed() {
When you build the application, it will automatically generate IssuesServiceBase and IssuesServiceClient classes based on the .proto file. You can view the complete .proto file with request and response methods in \IssuesData\issuesdata.proto.
To proceed, create a command that calls the service's FetchIssuesAsync method. In this command, specify a request protocol buffer object (Fetch in this example). Pass this object to the client's FetchIssuesAsync method. When the remote procedure call (RPC) is complete, the service returns a response protocol buffer object (Issues in this example).
public void FetchIssues(FetchRowsAsyncArgs args) {
    args.Result = GetIssuesAsync(args);
async Task<FetchRowsResult> GetIssuesAsync(FetchRowsAsyncArgs args) {
    var take = args.Take ?? 30;
    var issues = await client.FetchIssuesAsync(new Fetch {
        Skip = args.Skip,
        Take = take,
        Sort = GetIssueSortOrder(args.SortOrder),
        Filter = (IssueFilter)args.Filter
    var issuesArray = issues.Items.ToArray();
    return new FetchRowsResult(issuesArray, hasMoreRows: issuesArray.Length == take);
Assign the InfiniteAsyncSource virtual source to the GridControl's ItemsSource property and bind the FetchIssues command to the virtual source's FetchRowsCommand property:
    <dx:InfiniteAsyncSource ElementType="{x:Type issuesdata:Issue}" 
                            FetchRowsCommand="{Binding FetchIssuesCommand}"/>

REST Services, Custom WCF Services and More

Virtual Sources also allow you to connect the DevExpress WPF Data Grid to other services including REST Services, Custom WCF Services, etc.
If you'd like to explore this topic further, please review the following at your convenience: Virtual Sources Overview.

Your Feedback

As always, should you have any feedback or questions, please submit your comments below or create a ticket on the DevExpress Support Center.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.