https://github.com/windowsnt/winui3-cpp-controls
A port of the community toolkit for C# into C++ for Desktop WinUI3 apps.
https://github.com/windowsnt/winui3-cpp-controls
Last synced: 10 months ago
JSON representation
A port of the community toolkit for C# into C++ for Desktop WinUI3 apps.
- Host: GitHub
- URL: https://github.com/windowsnt/winui3-cpp-controls
- Owner: WindowsNT
- License: mit
- Created: 2025-08-01T10:10:50.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-01T11:23:02.000Z (11 months ago)
- Last Synced: 2025-08-01T12:47:21.172Z (11 months ago)
- Language: C++
- Size: 238 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# WinUI3 C++ controls
From the WinUI3 Community Kit which is C# only I am porting some controls to C++. Including a Sample application that demonstrates them.
Currently, Resizer and StaggeredLayout are available.
## Resizer
A control to change a double property.
1. Put the style to your generic.xaml in Themes\ (change the namespace)
2. Put Resizer h/cpp/idl to your project, changing the namespace
To your layout then:
```
```
This creates a horizontal splitter (Vertical is also supported) which modifies the double value R1. This value can then be used into another control:
```
Text 1
Text 2
```
You can also use it on a grid to size the entire grid row or column by having the ColumnDefinition's Width bound to that variable.
For a full example, see [XAML Lab](https://github.com/WindowsNT/XAML-Lab/), direct link [here](https://www.turbo-play.com/update2/tu.php?p=f3cf159b-de75-4427-8fe0-81a7ae61d3fa&f=88887777-A932-7654-A2E5-DECB481E355D).
## StaggeredLayout
A panel that arranges its children in a staggered grid layout, similar to a masonry layout.
Put the StaggeredLayout h/cpp/idl to your project, changing the namespace. No generic.xaml is needed for this control.
```
```
```
// Example data: 30 rectangles of random height
winrt::Windows::Foundation::Collections::IObservableVector items =
winrt::single_threaded_observable_vector();
winrt::Windows::Foundation::Collections::IObservableVector TheItems()
{
items.Clear();
for (int i = 0; i < 30; ++i)
{
int height = std::uniform_int_distribution (10, 50)(gen);
winrt::Sample::Item item;
item.Number1((double)height);
items.Append(item);
}
return items;
}
```