Saturday, July 8, 2017

WPF Tip #15 - Extended WPF Toolkit - The DataGrid Control

Tip #15 is a quick detour. We'll get back to using the CalculatorUpDown control in Tip #16.

If you are looking for a quick, free way to upgrade your application's DataGrid look and behavior, the Extended WPF Toolkit includes a DataGrid which provides a significant upgrade over the WPF DataGrid in the .NET Framework.

Here is a simple Grid with a standard DataGrid in the first row and the Toolkit's DataGridControl in the second row. Both are bound to the same ItemsSource, an ObservableCollection of three fictional videos.
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
    <DataGrid ItemsSource="{Binding Path=MediaCatalog, IsAsync=True}"/>

    <xcdg:DataGridControl Grid.Row="1" ItemsSource="{Binding Path=MediaCatalog, IsAsync=True}"/>
This is what we get when running the application.

With no customization, there's a much cleaner look. You also get an improved editing experience. When clicking into the PurchaseDate column, the grid detects that the underlying data type is DateTime, and provides a Date Picker to update the value.

For more information about features available in the control, go check out the CodePlex site (migrating soon).

Happy Coding!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.