1024programmer Asp.Net CPF C# cross-platform UI framework is open source

CPF C# cross-platform UI framework is open source

CPF C# cross-platform UI framework is open source


C# cross-platform UI framework

Provides NETStandard2.0 and net4 libraries, which can be cross-platform through Netcore and support Windows, Mac, and Linux. Net4 can support XP.

Each platform operates with the same effect and does not rely on system controls. Supports forms, controls can be arbitrarily transparent, supports special-shaped forms, and supports SVG icon display.

Supports animation, data binding, Mvvm mode, CSS, etc., simplifies the writing of dependent properties and data binding, and provides data context and command context for binding.

Describe directly using CSS and C# code, providing a designer to generate C# code and developer tools to view and debug elements.

The same concept as WPF, any control can be arbitrarily designed with templates to achieve various effects. In addition to using platform-related APIs, it can basically be written once and run anywhere.

Comprehensive support for localization, support for domestic Linux + Loongson, Feiteng, Zhaoxin, Haiguang and other CPU platforms

Software architecture description

CPF is the main framework, CPF.Skia uses skia for graphics adaptation, and CPF.Windows, CPF.Linux, CPF.Mac, and CPF.Android are adapters for each platform.

All controls are self-drawn, which ensures rendering consistency across platforms. Skia’s hardware acceleration can be turned on. On the Windows side, you can also choose GDI+ as graphics rendering

C# describes UI

public class Window1 : Window
     protected override void InitializeComponent()
         Title = "title";
         Width = 500;
         Height = 400;
         Background = null;
         Children.Add(new WindowFrame(this, new Panel
             Width = "100%",
             Height = "100%",
             Children =
                 new StackPanel{
                     Size = SizeField.Fill,
                     Children = {
                         new Label{
                             Text = "label",
                             Bindings = {
                                 {nameof(Label.Text),nameof(MainModel.Test) },
                                 //{ nameof(Label.Text), nameof(MainModel.Test), null, BindingMode.OneWay, (string a)=>a+"converter" }
                             Bindings = {
                                 {nameof(Label.Text),nameof(MainModel.Test) }


CSS description style

It should be noted that only the CSS format is used here, and it is not compatible with the CSS of the web page

Button {
     BorderFill: #DCDFE6;
     IsAntiAlias: True;
     CornerRadius: 4,4,4,4;
     Background: #FFFFFF;

     Button[IsMouseOver=true] {
         BorderFill: rgb(198,226,255);
         Background: rgb(236,245,255);
         Foreground: rgb(64,158,255);

     Button[IsPressed=true] {
         BorderFill: rgb(58,142,230);


Instructions for use

Open source address: https://gitee.com/csharpui/CPF

Clone/download directly to compile, start ConsoleApp1 directly to see the running effect

CPF usage documentation http://cpf.cskin.net/Course/#/

Extension library

https://gitee.com/csharpui/cpf.cef uses CPF to encapsulate cef, cross-platform browser control

https://gitee.com/csharpui/cpf.vlc uses CPF to encapsulate vlc, cross-platform video playback control

Other instructions

I have been struggling with whether to open source or not. It is too difficult for one person to do it. We welcome everyone to work together to strengthen the open source community

There are definitely many people who will compare CPF with Avalonia and Maui, and choose according to your preferences and needs. CPF does not have Xaml, and it is not ruled out that Xaml functions may be added in the future. CPF will try its best to adapt to the domestic system and environment.

Effect screenshot


This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/811252

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us


Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top