🕓 4 MINIf you’ve ever …
Whether you’re building a desktop dashboard, a web-based admin panel, or a mobile app for field data entry, at some point, you’ll need to display and interact with structured tabular data. And that’s where things can get tricky.
While .NET developers are creating awesome cross-platform apps with the Uno Platform, they might need a good-looking, lightweight, fast, and reliable DataGrid. That’s exactly why I created WinUI.TableView: a customizable, lightweight, and developer-friendly DataGrid control tailored for WinUI 3 and now extended to support the Uno Platform, making it run on almost any platform.
In this article, you’ll learn how to get started with an open-source community project with support for Uno Platform – WinUI.TableView, explore its core features, and see how it can help you build rich, cross-platform data-driven applications using .NET and Uno Platform.
Install-Package WinUI.TableView
MainPage.xaml
, add the WinUI.TableView
control:
Create a simple model class with properties to be represented in the TableView
cells:
public class Item : INotifyPropertyChanged
{
private string? _name;
private double _price;
private int _quantity;
private DateOnly _purchaseDate;
public string? Name
{
get => _name;
set
{
_name = value;
OnPropertyChanged(nameof(Name));
}
}
public double Price
{
get => _price;
set
{
_price = value;
OnPropertyChanged(nameof(Price));
}
}
public int Quantity
{
get => _quantity;
set
{
_quantity = value;
OnPropertyChanged(nameof(Quantity));
}
}
public DateOnly PurchaseDate
{
get => _purchaseDate;
set
{
_purchaseDate = value;
OnPropertyChanged(nameof(PurchaseDate));
}
}
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler? PropertyChanged;
}
In your MainPage.xaml.cs
, set up the data context and bind data to the TableView
:
public sealed partial class MainPage : Page
{
public IList- Items { get; }
public MainPage()
{
this.InitializeComponent();
Items = Enumerable.Range(1, 20).Select(i => GetRandomItem(i)).ToList();
}
private static Item GetRandomItem(int i)
{
return new Item
{
Name = $"Random Item {i}",
Price = Math.Round(Random.Shared.NextDouble() * 100, 2),
Quantity = Random.Shared.Next(1, 100),
PurchaseDate = DateOnly.FromDateTime(DateTime.Today.AddDays(Random.Shared.Next(-90, 90)))
};
}
}
WinUI.TableView
populated with the rows and cells from your Items
collection.This is a guest blog post written by an open-source maintainer whose library supports Uno Platform. We’re highlighting great community champions to help them gain visibility and grow contributions to their projects, contributing to a healthy Uno Platform ecosystem, especially in areas with high demand, such as Data Grids.
Please note that Uno Platform makes no warranties regarding the support or maintenance of this library.
WinUI.TableView
focuses on delivering the most essential data grid features that developers expect in modern apps, with a clean and extensible design. Here are some of the key capabilities:
Improve readability by enabling alternate row backgrounds and foregrounds. This makes it easier to scan rows, especially in dense datasets. The colors are fully customizable using XAML.
AlternateRowBackground="Gray"
AlternateRowForeground="AliceBlue"
WinUI.TableView includes built-in support for multi-level column sorting with a simple header click. Users can easily sort data by one or more columns, and developers have full control over the sorting logic.
Sorting is enabled by default but can be toggled globally using the TableView.CanSortColumns property, or controlled per-column using the TableViewColumn.CanSort property, giving you fine-grained flexibility.
WinUI.TableView
offers a built-in, Excel-style column filtering experience to help users quickly narrow down data. Each column header includes a filter button that opens a flyout, allowing users to apply text-based filters interactively.
Filtering is enabled by default but can be disabled for individual columns using the TableViewColumn.CanFilter
property. Developers can also toggle filtering globally by setting the TableView.CanFilterColumns
property. This feature makes it easy to deliver powerful, user-friendly filtering without writing custom UI.
WinUI.TableView
gives developers full control over grid line visibility and styling. You can choose to display grid lines for headers, cells, or both, and configure them to appear vertically, horizontally, or in both directions. Their thickness and colors are fully customizable to match the visual style of your application.WinUI.TableView
provides built-in context flyouts for both individual cells and entire rows, enabling users to perform quick actions like copy, edit, or custom commands. These flyouts are fully customizable, allowing you to define your own context menus at the cell level, row level, or both. This makes it easy to offer inline operations without cluttering the UI.
WinUI.TableView is designed to be a powerful and flexible solution for developers building modern, cross-platform apps in .NET with WinUI3 or Uno Platform. To exlore more features please try the WinUI.TableView.SampleApp
I look forward to community feedback, contributions, and ideas for new features!
We encourage you to try WinUI.TableView in your next Uno Platform project. If you have questions or want to share what you’ve built, join the Uno Platform community on Discord and GitHub.
Guest Post contributed by
Tags: Data, TableView, DataGrid
Uno Platform
360 rue Saint-Jacques, suite G101,
Montréal, Québec, Canada
H2Y 1P5
USA/CANADA toll free: +1-877-237-0471
International: +1-514-312-6958
Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch