An example is based on a World Net Core3.0 Hello WPF framework of the WPF framework based Net Core3.0 Hello World Examples

Excerpt: https://www.cnblogs.com/JerryMouseLi/p/11812972.html

Examples of a World Net Core3.0 the WPF framework based Hello

 

Examples of a World Net Core3.0 the WPF framework based Hello

1. Create a WPF solutions

Net Core version 1.1 to create a WPF project

1.2 Specify the project name, path, solution name

2. dependent libraries and program files 4 Introduction

2.1 framework library dependencies

Dependence Microsoft.NETCore.App with Microsoft.WindowsDesktop.App.WPF

Description 2.2 Makefile

Generates four files App.xaml, App.xaml.cs, MainWindow.xaml, MainWindow.xaml.cs

2.2.1 App.xaml

App.xaml set the starting file and the application's resources. Generally refers to resource here:

  • Other paths xaml style files;
  • Set the theme color, background color, form, style;
  • Button style, menu style;
  • Custom pop styles, custom scroll bar width;
    ...... etc.

App.xaml document reads as follows:

<Application x:Class="IBMSManager.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:IBMSManager" StartupUri="MainWindow.xaml"> <Application.Resources> 系统资源定义区 </Application.Resources> </Application>
  • Application x: Class = "IBMSManager.App" represents the Application class background
  • = xmlns " http://schemas.microsoft.com/winfx/2006/xaml/presentation " indicates the default namespace WPF application mapping
  • xmlns: X = " http://schemas.microsoft.com/winfx/2006/xaml " mapping Extensible Application Markup Language (the XAML) of the extension namespace typically mapped as a prefix X
  • xmlns: local =: name "clr-namespace IBMSManager" project is IBMSManager
  • StartupUri = "MainWindow.xaml" pledged to launch the application form

2.2.2 App.xaml.cs

App.xaml background documents, integrated self System.Windows.Application, treatment-related settings for the entire WPF application.

2.2.3 MainWindow.xaml

WPF and XAML application program interface design documents

<Window x:Class="IBMSManager.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:IBMSManager" mc:Ignorable="d" Title="IBMSManager" Height="450" Width="800"> <Grid> </Grid> </Window>

2.2.4 MainWindow.xaml.cs

MainWindow.xaml background documents, integrated self System.Windows.Window, for interactive logic of the code written MainWindow.xaml

3. Hello World example

3.1 Drag the Button control to the WPF form

MainWindow.xaml file will automatically add the following code

    <Grid>
        <Button Content="Button" HorizontalAlignment="Right" Margin="0,0,554,254" VerticalAlignment="Bottom"/> </Grid>

Grid tag code is mainly described in the button attributes

Double-click the Add button in the button design event 3.2

MainWindow.xaml file will automatically add the Click = "Button_Click

    <Grid>
        <Button Content="Button" HorizontalAlignment="Right" Margin="0,0,554,254" VerticalAlignment="Bottom" Click="Button_Click"/> </Grid>

Background MainWindow.xaml.cs file is automatically added to the event handler

private void Button_Click(object sender, RoutedEventArgs e) { }

3.3 event handler to add a message box

After clicking the button, a message box appears Hello World.

    private void Button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello World!"); }

3.4 effect is as follows

The Sky is the limit.
 
Tags:  WPF

 

 

Examples of a World Net Core3.0 the WPF framework based Hello

1. Create a WPF solutions

Net Core version 1.1 to create a WPF project

1.2 Specify the project name, path, solution name

2. dependent libraries and program files 4 Introduction

2.1 framework library dependencies

Dependence Microsoft.NETCore.App with Microsoft.WindowsDesktop.App.WPF

Description 2.2 Makefile

Generates four files App.xaml, App.xaml.cs, MainWindow.xaml, MainWindow.xaml.cs

2.2.1 App.xaml

App.xaml set the starting file and the application's resources. Generally refers to resource here:

  • Other paths xaml style files;
  • Set the theme color, background color, form, style;
  • Button style, menu style;
  • Custom pop styles, custom scroll bar width;
    ...... etc.

App.xaml document reads as follows:

<Application x:Class="IBMSManager.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:IBMSManager" StartupUri="MainWindow.xaml"> <Application.Resources> 系统资源定义区 </Application.Resources> </Application>
  • Application x: Class = "IBMSManager.App" represents the Application class background
  • = xmlns " http://schemas.microsoft.com/winfx/2006/xaml/presentation " indicates the default namespace WPF application mapping
  • xmlns: X = " http://schemas.microsoft.com/winfx/2006/xaml " mapping Extensible Application Markup Language (the XAML) of the extension namespace typically mapped as a prefix X
  • xmlns: local =: name "clr-namespace IBMSManager" project is IBMSManager
  • StartupUri = "MainWindow.xaml" pledged to launch the application form

2.2.2 App.xaml.cs

App.xaml background documents, integrated self System.Windows.Application, treatment-related settings for the entire WPF application.

2.2.3 MainWindow.xaml

WPF and XAML application program interface design documents

<Window x:Class="IBMSManager.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:IBMSManager" mc:Ignorable="d" Title="IBMSManager" Height="450" Width="800"> <Grid> </Grid> </Window>

2.2.4 MainWindow.xaml.cs

MainWindow.xaml background documents, integrated self System.Windows.Window, for interactive logic of the code written MainWindow.xaml

3. Hello World example

3.1 Drag the Button control to the WPF form

MainWindow.xaml file will automatically add the following code

    <Grid>
        <Button Content="Button" HorizontalAlignment="Right" Margin="0,0,554,254" VerticalAlignment="Bottom"/> </Grid>

Grid tag code is mainly described in the button attributes

Double-click the Add button in the button design event 3.2

MainWindow.xaml file will automatically add the Click = "Button_Click

    <Grid>
        <Button Content="Button" HorizontalAlignment="Right" Margin="0,0,554,254" VerticalAlignment="Bottom" Click="Button_Click"/> </Grid>

Background MainWindow.xaml.cs file is automatically added to the event handler

private void Button_Click(object sender, RoutedEventArgs e) { }

3.3 event handler to add a message box

After clicking the button, a message box appears Hello World.

    private void Button_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello World!"); }

3.4 effect is as follows

Guess you like

Origin www.cnblogs.com/xcj26/p/11817449.html