Skip to main content Skip to footer

A WPF Datagrid for Any Industry

Power your enterprise WPF applications with ComponentOne's FlexGrid, a versatile, high-performance datagrid. Datagrids are the standard approach to displaying, editing, and analyzing tabular data in any type of business application. C1FlexGrid allows you to:

  • Load and display large data sets quicker than any other .NET datagrid
  • Control your application's optics and functionality with a customizable datagrid
  • Take advantage of built-in features like filtering, sorting, grouping, hierarchical tree views, search, and more

Whether it’s a productivity app for manufacturing, a financial app for accountants, or a scheduling app for client management, a datagrid helps users manage data efficiently. C1FlexGrid supports unique WPF datagrid features. Below we've applied some of these features to industry-specific examples.

WPF Datagrid for Product Inventory

Catalog, track, and update the number of products available on the shelf or in the warehouse.

An effective product inventory datagrid lets you quickly update product quantities, flag products as unavailable, and select products for further action (order new, update description, remove from a database, etc). Features include:

  • Checklist selection allows you to perform an action against multiple items at once
  • Apply different colors to cell text to indicate high or low stock
  • Master-detail data binding for a quick view of related items in the database

A WPF Datagrid for Any Industry

WPF Datagrid for Order Tracking

Display all available orders within a time period. Search, filter, and find an order for further inquiries.

An order tracking datagrid must support fast search, intricate filtering, quick editing, and flexible export functionality so that reports can be delivered in a variety of ways.

Features include:

  • Search and filter across columns to lookup a specific order
  • Drill-down into order details to see additional information outside the main grid layout
  • Export to Microsoft Excel, PDF or print to create an invoice

A WPF Datagrid for Any Industry

WPF Datagrid for Sales Analysis

Determine final sales results for the desired subset of a given dataset.
Datagrids provide great tools for ad-hoc grouping, filtering, and aggregating. They are fast and allow the user to work with sales figures covering a large time period.

  • Sort results by date or revenue to see the most recent or highest period
  • Group the data by date, category or salesperson to see highest or lowest performing areas
  • Aggregate the data down the entire grid or each group to show totals and averages

A WPF Datagrid for Any Industry

WPF Datagrid for Employee Management

Every internal enterprise app needs employee management datagrid. A WPF datagrid gives the user more flexibility than a plain input form. Additional features include:

  • Freeze columns on the left so employee names remain in view regardless of how much data you need to display
  • Let users perform inline editing to eliminate the need for separate editing form
  • Customize and merge cells to create an employee schedule view.

A WPF Datagrid for Any Industry

WPF Datagrid for Finance Dashboards

Using a WPF datagrid as a dashboard is similar to using it for sales analysis. However, a dashboard focuses more on display elements than user interaction.

Highly visual datagrids make great additions to dashboards. Dynamic updates make it work well as a live console for users to monitor. The following features are supported in the WPF C1FlexGrid control:

  • Apply conditional formatting of cells to visualize different asset performance
  • Enable live data updates to show underlying changes automatically
  • Embed sparklines, gauges, and indicators inside cells to visualize trends

A WPF Datagrid for Any Industry

Working with a WPF Datagrid like FlexGrid

FlexGrid is a WPF datagrid control that displays data in a customizable table. It provides a flexible way to display a collection of data in rows and columns. A WPF datagrid like FlexGrid generates appropriate columns automatically for you. It's very easy to get up and running.
Before using FlexGrid in a real-world app, you should understand three core concepts:

  • Populating data from a database
  • Cell customization
  • Enabling analysis features

How to Display Data from a SQL Server Database

The FlexGrid datagrid control lets you display and edit data from different sources, such as an SQL database, LINQ query, or any other bindable data source. FlexGrid uses similar properties as the WPF DataGrid control to populate it, such as the ItemsSource property.

Take advantage of these similarities, and follow Microsoft’s documentation on displaying data from a SQL Server database all the way to the final step. At the last step, use FlexGrid instead of DataGrid.

Replace the WPF DataGrid ItemsSource with FlexGrid inside the Window_Loaded event.

private void Window_Loaded(object sender, RoutedEventArgs e)  
        {  
            var query =  
            from product in dataEntities.Products  
            where product.Color == "Red"  
            orderby product.ListPrice  
            select new { product.Name, product.Color, CategoryName = product.ProductCategory.Name, product.ListPrice };  
            flexGrid1.ItemsSource = query.ToList();  
        }  

How to Customize the Datagrid Cell Appearance

Different WPF datagrid use cases require some level of cell customization. The C1FlexGrid control for WPF features several flexible solutions. Let’s list them in order from most simple to most complex.

  • Format a cells value, or change its font or alignment: Simply set properties on the control. This simplest approach will modify every cell in a column. To access each column in code or XAML use the Columns collection.
  • Change the UI of every cell within a column by defining the cell template. The CellTemplate is a XAML-based approach, so you can essentially display any XAML element within a C1FlexGrid cell (the sky is the limit).
  • Change the style of only some cells within a column, based upon the cell’s value, with a CellFactory in code. A CellFactory is a special class that basically triggers for each cell and gives you the cell information in code so you can apply your logic. For example, you can easily check if a cell belongs to a certain column and if its value is below a certain threshold.
  • Combine the XAML-based cell template approach from #2 with the conditional logic of #3 by using converters. Converters are a basic feature of WPF, and they allow you to inject conditional coded logic to change how something is displayed in XAML.

Check out the ConditionalFormatting sample that shows how to implement #2, #3, and #4.

A WPF Datagrid for Any Industry

How to Enable Analysis Features in C1FlexGrid

The WPF datagrid control is useful as an analysis tool due to its array of filtering, grouping, and aggregating features. Aggregating basically means totaling or taking the average of all records within a group – nothing that complicated, but it’s super handy when the datagrid control does it for you.

WPF C1FlexGrid control supports the following analysis features:

Aggregates displayed in columns

Datagrid is a Powerful UI Tool

Datagrids serve a variety of purposes in business apps from displaying and editing tabular data to providing powerful runtime features for interactive analysis. Due to its versatility, a WPF datagrid works in practically any industry as a powerful UI tool. The best components are reusable and strike the perfect balance between customization and ease of use. We designed the C1FlexGrid control for WPF with this flexibility in mind.

Hopefully, this article helps you launch into WPF datagrid development using FlexGrid no matter what industry your app identifies.

Download Now!

ComponentOne Product Manager Greg Lutz

Greg Lutz

comments powered by Disqus