Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: w-ahmad/WinUI.TableView
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0-preview3
Choose a base ref
...
head repository: w-ahmad/WinUI.TableView
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 7,023 additions and 992 deletions.
  1. +24 −0 .github/ISSUE_TEMPLATE/bug_report.md
  2. +20 −0 .github/ISSUE_TEMPLATE/feature_request.md
  3. +7 −7 .github/workflows/cd-build.yml
  4. +28 −0 .github/workflows/ci-build.yml
  5. +2 −2 LICENSE.txt → LICENSE.md
  6. +183 −18 README.md
  7. +2 −2 src/Directory.Build.props
  8. +3 −3 src/SampleApp/MainWindow.xaml
  9. +5 −0 src/SampleApp/SampleApp.csproj
  10. +45 −0 ....TableView/CommunityToolkit.WinUI.Collections/AdvancedCollectionView.CollectionChangedListener.cs
  11. +27 −49 src/WinUI.TableView/CommunityToolkit.WinUI.Collections/AdvancedCollectionView.cs
  12. +97 −0 src/WinUI.TableView/Controls/TableViewDatePicker.cs
  13. +221 −0 src/WinUI.TableView/Controls/TableViewTimePicker.cs
  14. +18 −0 src/WinUI.TableView/Converters/BoolToVisibilityConverter.cs
  15. +49 −0 src/WinUI.TableView/Extensions/DateTimeExtensions.cs
  16. +20 −0 src/WinUI.TableView/Extensions/ItemIndexRangeExtensions.cs
  17. +18 −1 src/WinUI.TableView/Extensions/ObjectExtensions.cs
  18. +40 −0 src/WinUI.TableView/Extensions/TableViewCellSlotExtensions.cs
  19. +59 −0 src/WinUI.TableView/Extensions/TypeExtensions.cs
  20. +156 −0 src/WinUI.TableView/Helpers/DateTimeFormatHelper.cs
  21. +31 −0 src/WinUI.TableView/Helpers/KeyBoardHelper.cs
  22. +610 −0 src/WinUI.TableView/TableView.Properties.cs
  23. +1,194 −82 src/WinUI.TableView/TableView.cs
  24. +38 −0 src/WinUI.TableView/TableViewAutoGeneratingColumnEventArgs.cs
  25. +19 −0 src/WinUI.TableView/TableViewBoundColumn.cs
  26. +359 −65 src/WinUI.TableView/TableViewCell.cs
  27. +45 −0 src/WinUI.TableView/TableViewCellContextFlyoutEventArgs.cs
  28. +32 −0 src/WinUI.TableView/TableViewCellSelectionChangedEvenArgs.cs
  29. +6 −0 src/WinUI.TableView/TableViewCellSlot.cs
  30. +93 −0 src/WinUI.TableView/TableViewCellsPresenter.cs
  31. +42 −5 src/WinUI.TableView/TableViewCheckBoxColumn.cs
  32. +214 −15 src/WinUI.TableView/TableViewColumn.cs
  33. +19 −3 src/WinUI.TableView/TableViewColumnHeader.FilterItem.cs
  34. +81 −10 src/WinUI.TableView/TableViewColumnHeader.OptionsFlyoutViewModel.cs
  35. +334 −42 src/WinUI.TableView/TableViewColumnHeader.cs
  36. +37 −0 src/WinUI.TableView/TableViewColumnPropertyChanged.cs
  37. +0 −5 src/WinUI.TableView/TableViewColumnsColection.cs
  38. +66 −0 src/WinUI.TableView/TableViewColumnsCollection.cs
  39. +106 −13 src/WinUI.TableView/TableViewComboBoxColumn.cs
  40. +23 −0 src/WinUI.TableView/TableViewCopyToClipboardEventArgs.cs
  41. +22 −0 src/WinUI.TableView/TableViewCornerButtonMode.cs
  42. +30 −0 src/WinUI.TableView/TableViewCurrentCellChangedEventArgs.cs
  43. +232 −0 src/WinUI.TableView/TableViewDateColumn.cs
  44. +8 −0 src/WinUI.TableView/TableViewExportContentEventArgs.cs
  45. +27 −0 src/WinUI.TableView/TableViewGridLinesVisibility.cs
  46. +65 −106 src/WinUI.TableView/TableViewHeaderRow.OptionsFlyoutViewModel.cs
  47. +419 −37 src/WinUI.TableView/TableViewHeaderRow.cs
  48. +18 −4 src/WinUI.TableView/TableViewNumberColumn.cs
  49. +416 −42 src/WinUI.TableView/TableViewRow.cs
  50. +45 −0 src/WinUI.TableView/TableViewRowContextFlyoutEventArgs.cs
  51. +22 −0 src/WinUI.TableView/TableViewSelectionUnit.cs
  52. +85 −10 src/WinUI.TableView/TableViewTemplateColumn.cs
  53. +18 −5 src/WinUI.TableView/TableViewTextColumn.cs
  54. +127 −0 src/WinUI.TableView/TableViewTimeColumn.cs
  55. +57 −8 src/WinUI.TableView/TableViewToggleSwitchColumn.cs
  56. +17 −446 src/WinUI.TableView/Themes/Generic.xaml
  57. +207 −0 src/WinUI.TableView/Themes/Resources.xaml
  58. +119 −0 src/WinUI.TableView/Themes/TableView.xaml
  59. +83 −0 src/WinUI.TableView/Themes/TableViewCell.xaml
  60. +43 −0 src/WinUI.TableView/Themes/TableViewCellsPresenter.xaml
  61. +231 −0 src/WinUI.TableView/Themes/TableViewColumnHeader.xaml
  62. +178 −0 src/WinUI.TableView/Themes/TableViewHeaderRow.xaml
  63. +91 −0 src/WinUI.TableView/Themes/TableViewRow.xaml
  64. +51 −0 src/WinUI.TableView/Themes/TableViewTimePicker.xaml
  65. +27 −0 src/WinUI.TableView/VisualStates.cs
  66. +12 −12 src/WinUI.TableView/WinUI.TableView.csproj
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

### Description:
A clear and concise description of what the bug is.

### Steps to Reproduce:
Steps to reproduce the behavior.

### Expected behavior:
A clear and concise description of what you expected to happen.

### Screenshots:
If applicable, add screenshots to help explain your problem.

### Environment:
- Package Version:
- WinAppSDK Version:
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
14 changes: 7 additions & 7 deletions .github/workflows/cd-build.yml
Original file line number Diff line number Diff line change
@@ -10,26 +10,26 @@ jobs:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.4

- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v2

- name: 'Get Version'
id: version
uses: battila7/get-version-action@v2
uses: battila7/get-version-action@v2.2.1

- name: Build
run: |
msbuild /restore /t:Build,Pack src/WinUI.TableView/WinUI.TableView.csproj /p:Configuration=Release /p:PackageVersion=${{ steps.version.outputs.version-without-v }}
msbuild /restore /t:Build,Pack src/WinUI.TableView/WinUI.TableView.csproj /p:Configuration=Release /p:Version=${{ steps.version.outputs.version-without-v }}
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: NuGet Packages
path: artifacts/NuGet/Release

- name: Push to NuGet
run: |
dotnet nuget push artifacts\NuGet\Release\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org
dotnet nuget push artifacts\NuGet\Release\*.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org
dotnet nuget push artifacts\NuGet\Release\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push artifacts\NuGet\Release\*.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
28 changes: 28 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci-build

on:
push:
branches: main
pull_request:
branches: main

jobs:
build:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4.1.4

- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2

- name: Build
run: |
msbuild /restore /t:Build,Pack src/WinUI.TableView/WinUI.TableView.csproj /p:Configuration=Release /p:Version=1.0.${{ github.run_number }}
msbuild /restore src/SampleApp/SampleApp.csproj /p:Configuration=Release /p:Platform=x64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: NuGet Packages
path: artifacts/NuGet/Release
4 changes: 2 additions & 2 deletions LICENSE.txt → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License
### MIT License

Copyright (c) [year] [fullname]
Copyright (c) [2024] [w-ahmad https://github.com/w-ahmad]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
201 changes: 183 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,191 @@

# WinUI.TableView
TableView for WinUI is derived from ListView and is blazing fast data loading. Internally it uses it's own implementation of AdvancedCollectionViewSource from CommunityToolkit as ItemsSource.

### Editing
![image](https://github.com/w-ahmad/WinUI.TableView/blob/main/screenshots/Editing1.png)
![image](https://github.com/w-ahmad/WinUI.TableView/blob/main/screenshots/Editing2.png)
`WinUI.TableView` is a lightweight and fast data grid control made for WinUI apps. It is easy to use, and capable of handling large number of items with a focus on performance. It's derived from `ListView` so you will experience fluent look and feel in your project. It comes with all the essential features you need, plus extras like an Excel like column filter, options buttons (for columns and the TableView) and easy data export.

[![ci-build](https://github.com/w-ahmad/WinUI.TableView/actions/workflows/ci-build.yml/badge.svg)](https://github.com/w-ahmad/WinUI.TableView/actions/workflows/ci-build.yml)
[![cd-build](https://github.com/w-ahmad/WinUI.TableView/actions/workflows/cd-build.yml/badge.svg)](https://github.com/w-ahmad/WinUI.TableView/actions/workflows/cd-build.yml)
[![nuget](https://img.shields.io/nuget/v/WinUI.TableView)](https://www.nuget.org/packages/WinUI.TableView/)
[![nuget](https://img.shields.io/nuget/dt/WinUI.TableView)](https://www.nuget.org/packages/WinUI.TableView/)

## Contributors
<a href="https://github.com/w-ahmad/WinUI.TableView/graphs/contributors">
<img src="https://contrib.rocks/image?repo=w-ahmad/WinUI.TableView" />
</a>


## Features

- **Auto-generating Columns**: Automatically generate columns based on the data source.
- **Individual cell selection**: You can select any cell for the ease of access and better editing experience.
- **Copy row or cell content**: TableView allows you to copy rows or cells content, with the option to include or exclude column headers.
- **Editing**: Modify cell content directly within the TableView by double tapping on a cell.
- **Sorting**: Offers built in column sorting.
- **Excel-like Column Filter**: TableView allows you to filter data within columns with an excel like flyout to enhance data exploration and analysis.
- **Export functionality**: Built-in export functionality to export data to CSV format. This feature can be enabled by setting the `ShowExportOptions = true`.

## Getting Started

### 1: Install NuGet package to your project

You can install the `WinUI.TableView` NuGet package using the NuGet Package Manager or by running the following command in the Package Manager Console:

```bash
Install-Package WinUI.TableView
```

### 2. Create a New WinUI 3 Project

If you don't already have a WinUI 3 project, create one in Visual Studio.

### 3. Add `WinUI.TableView` to Your XAML

In your `MainWindow.xaml`, add the `WinUI.TableView` control:

```xaml
<Window
x:Class="App1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:tableView="using:WinUI.TableView">

<Grid>
<tableView:TableView x:Name="MyTableView"
ItemsSource="{x:Bind ViewModel.Items}"
AutoGenerateColumns="True" />
</Grid>
</Window>
```

### 4. Bind Data to `TableView`

### Sorting
![image](https://github.com/w-ahmad/WinUI.TableView/blob/main/screenshots/Sorting.png)
In your `MainPage.xaml.cs`, set up the data context and bind data to the `TableView`:

### Excel like Filter
![image](https://github.com/w-ahmad/WinUI.TableView/blob/main/screenshots/Filter.png)
```csharp
public sealed partial class MainWindow : Window
{
public MainViewModel ViewModel { get; } = new MainViewModel();

### Options button
![image](https://github.com/w-ahmad/WinUI.TableView/blob/main/screenshots/Options.png)
public MainWindow()
{
this.InitializeComponent();
}
}
```

### Exporting
- TableView selected rows or all rows can be exported to comma delimited (csv) file.
Create a simple `MainViewModel` with a collection of items to display:

### Column Types
```csharp
public class MainViewModel
{
public ObservableCollection<Item> Items { get; set; }

public MainViewModel()
{
Items = new ObservableCollection<Item>
{
new Item { Name = "Item 1", Price = 10.0, Quantity = 1 },
new Item { Name = "Item 2", Price = 15.0, Quantity = 2 },
// Add more items here
};
}
}

public class Item : INotifyPropertyChanged
{
private string _name;
private double _price;
private int _quantity;

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));
}
}

private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

public event PropertyChangedEventHandler PropertyChanged;
}
```

### 5. Run Your Application

Build and run your application. You should see the `TableView` populated with the rows and cells from your `ViewModel`.

## Customization

You can customize the appearance and behavior of the `TableView` by modifying its properties, templates, and styles. For example:

- **Column Customization**: Define custom columns based on data types.
- **Is ReadOnly**: You can make any column or the TableView itself read only.
- **Sorting and Filtering**: Enable sorting and filtering on specific columns or for the all columns.
- **TableView Options**: Turn on or off options flyout for the TableView based on your requirements.

```xml
<tableView:TableView x:Name="MyTableView"
ItemsSource="{x:Bind ViewModel.Items}"
AutoGenerateColumns="False">
<tableView:TableView.Columns>
<tableView:TableViewTextColumn Header="Name" Binding="{Binding Name}" />
<tableView:TableViewNumberColumn Header="Price" Binding="{Binding Price}" />
<tableView:TableViewTemplateColumn Header="Quantity">
<tableView:TableViewTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Quantity}" />
</DataTemplate>
</tableView:TableViewTemplateColumn.CellTemplate>
<tableView:TableViewTemplateColumn.EditingTemplate>
<DataTemplate>
<NumberBox Value="{Binding Quantity, Mode=TwoWay}" />
</DataTemplate>
</tableView:TableViewTemplateColumn.EditingTemplate>
</tableView:TableViewTemplateColumn>
</tableView:TableView.Columns>
</tableView:TableView>
```

### Available Column Types
1. TableViewTextColumn
2. TableViewNumberColumn
3. TableViewCheckBoxColumn
4. TableViewToggleSwitchColumn
5. TableViewComboBoxColumn
6. TableViewTemplateColumn
1. TableViewCheckBoxColumn
1. TableViewComboBoxColumn
1. TableViewNumberColumn
1. TableViewToggleSwitchColumn
1. TableViewTemplateColumn

## Contributing

Contributions are welcome from the community! If you find any issues or have suggestions for improvements, please submit them through the GitHub issue tracker or consider making a pull request.

## License

This project is licensed under the [MIT License](https://github.com/w-ahmad/WinUI.TableView?tab=MIT-1-ov-file).
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<Nullable>enable</Nullable>
<UseWinUI>true</UseWinUI>
<Platforms>x86;x64;arm64</Platforms>
<UseWinUI>true</UseWinUI>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions src/SampleApp/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right">
<Button Margin="16"
Content="Laod More Items"
Content="Load More Items"
Click="OnLoadMoreButtonClick" />
<Button Margin="16"
Content="Clear And Load"
@@ -30,7 +30,7 @@
<table:TableView x:Name="tableView"
Grid.Row="1"
Margin="16"
SelectionMode="Extended">
ShowExportOptions="True">
<table:TableView.Columns>
<table:TableViewTextColumn Header="Rank"
Binding="{Binding Rank}" />
@@ -48,7 +48,7 @@
<DataTemplate>
<TextBlock Text="{Binding First_ascent, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:MMM/dd/yyy}'}"
VerticalAlignment="Center"
Margin="8,0,0,0" />
Margin="12,0" />
</DataTemplate>
</table:TableViewTemplateColumn.CellTemplate>
<table:TableViewTemplateColumn.EditingTemplate>
5 changes: 5 additions & 0 deletions src/SampleApp/SampleApp.csproj
Original file line number Diff line number Diff line change
@@ -7,10 +7,15 @@
<SelfContained>true</SelfContained>
<WindowsPackageType>None</WindowsPackageType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\WinUI.TableView\WinUI.TableView.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.0.240109" />
</ItemGroup>

<ItemGroup>
<Content Update="Assets\mtns.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Loading