. NET Core UI framework Avalonia, uiavalonia

Source: Internet
Author: User

. NET Core UI framework Avalonia, uiavalonia

. NET Core UI framework Avalonia, Avalonia is a cross-platform UI framework based on wpf xaml, and supports multiple operating systems: Windows (. NET Framework ,.. NET Core), Linux (GTK), MacOS, Android, and iOS.

Avalonia is currently in the testing stage.

GitHub: https://github.com/AvaloniaUI/Avalonia

Development Preparation

VS 2017 install extended https://marketplace.visualstudio.com/items? ItemName = AvaloniaTeam. AvaloniaforVisualStudio

Then you can develop the project

Select Avalonia Application to create a project. By default, two frameworks. NET Framework 4.6.1 and. NET Core 2.0 are created.

You can createWindow andUserControl.

Sample UI Project

Create a basic project myapp and add several buttons to MainWindow. xaml, which is the syntax of wpf xaml, and can directly implement the corresponding layout.

<Window xmlns="https://github.com/avaloniaui"        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        Title="myapp">    <Grid Width="800" Height="600">      <StackPanel Margin="20">        <Button Content="Button1" Name="btn1"/>        <Button Content="Button2"/>        <Button Content="Button3"/>        <TextBox Text="LineZero" Name="myText"></TextBox>      </StackPanel>    </Grid>  </Window>

 

Background code

Public class MainWindow: Window {public MainWindow () {InitializeComponent (); # if DEBUG this. attachDevTools (); # endif} private void InitializeComponent () {AvaloniaXamlLoader. load (this); this. findControl <Button> ("btn1 "). click + = Btn1_Click;} private void Btn1_Click (object sender, Avalonia. interactivity. routedEventArgs e) {var txt = this. findControl <TextBox> ("myText"); txt. fontFamily = ""; txt. text = "LineZero button 1 ";}}

Run the program

By default, Chinese characters are displayed incorrectly. You can set the font.

Support installation for different systems: https://github.com/AvaloniaUI/Avalonia/wiki/Platform-support

 

AvalonStudio

Currently, Avalonia is a mature solution.

GitHub: https://github.com/VitalElement/AvalonStudio

At present, the official introduction has corresponding functions, and some operations are missing.

AvaloniaEdit. Demo is also a good example.

GitHub: https://github.com/AvaloniaUI/AvaloniaEdit

See the official documentation for better future of http://avaloniaui.net/guides/. NET Core.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.