https://github.com/idexus/CodeMarkup-WinUI
C# Code Markup Library for WinUI 3: User Interface Development with Fluent Methods
https://github.com/idexus/CodeMarkup-WinUI
Last synced: 17 days ago
JSON representation
C# Code Markup Library for WinUI 3: User Interface Development with Fluent Methods
- Host: GitHub
- URL: https://github.com/idexus/CodeMarkup-WinUI
- Owner: idexus
- License: mit
- Created: 2023-03-07T18:15:57.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-22T16:33:37.000Z (4 months ago)
- Last Synced: 2024-12-22T17:27:02.943Z (4 months ago)
- Language: C#
- Homepage:
- Size: 944 KB
- Stars: 29
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-winui - CodeMarkup for WinUI -   CodeMarkup for WinUI enables you to build user interfaces declaratively in C# code using fluent methods. With this library, you can create interfaces without the need for XAML. (Libraries / What We Track)
README
# Overview
__CodeMarkup for WinUI__ enables you to build user interfaces declaratively in C# code using fluent methods. With this library, you can create interfaces without the need for XAML.
# Example Page
```cs
using Windows.UI;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;namespace ExampleApp
{
using CodeMarkup.WinUI;[Bindable]
public partial class HomePage : Page
{
int count = 0;public HomePage()
{
this.Resources = new()
{
new ThemeValue { Key = "HeaderColor", Light = Colors.Navy, Dark = Colors.Aqua }
};this.VerticalAlignment = VerticalAlignment.Center;
Content = new StackPanel
{
new TextBlock()
.FontSize(45)
.Text("Code Markup for WinUI")
.TextAlignment(TextAlignment.Center)
.Foreground(e => e.ResourceKey("HeaderColor").Source(this)),new TextBlock()
.FontSize(20)
.Text("Welcome to the Quick Samples Gallery")
.TextAlignment(TextAlignment.Center),new Button()
.Content("Click me")
.Margin(0,35,0,15)
.FontSize(20)
.HorizontalAlignment(HorizontalAlignment.Center)
.OnClick(button =>
{
count++;
button.Content = $"Clicked {count} ";
button.Content += count == 1 ? "time" : "times";
})
};
}
}
}
```# Nuget
- [CodeMarkup.WinUI](https://www.nuget.org/packages/CodeMarkup.WinUI)
# In Your Project
__CodeMarkup for WinUI__ replaces some standard WinUI classes by subclassing them and adding new constructors and `IEnumerable` interface implementation. To use CodeMarkup controls in your projects, you need to include the `using CodeMarkup.WinUI` statement inside your app namespace.
```cs
using Windows.UI;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;namespace ExampleApp;
using CodeMarkup.WinUI;...
```Or:
```cs
using Windows.UI;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;namespace ExampleApp
{
using CodeMarkup.WinUI;
...
}
```# Disclaimer
__CodeMarkup for WinUI__ is a proof of concept. There is no official support. Use at your own risk.
# License
[The MIT License](LICENSE), Copyright (c) 2023 Pawel Krzywdzinski