WPF Application Using VS Code

Microsoft has an announced WPF & Winform are as an open-source. Both WPF & Winform are the most popular technologies in dotnet. This UI framework for building Windows desktop application that supported on .NET Core.

Microsoft has an announced WPF & Winform are as open source. Both, WPF & Winform are most popular technologies in dot net. This UI framework for building windows desktop application that supported on .NET Core.  

This technology can only run on windows OS. But after an announcement, it can run from Visual Studio code using Windows, Mac &Linux operating systems.  

Before you start the application, you must install .Net Core 3.0 version

You can download from here

Open visual studio code. If you need to download get it from here. Make sure the dotnet version using dotnet –v from VS Code terminal   

You can run the following command in terminal

dotnet new wpf -o MyWPFApp

cd MyWPFApp

Open the MainWindow.xaml file using this code

<Window x:Class="NewWPFApp.MainWindow"
        Title="MainWindow" Height="450" Width="900">
            <RowDefinition Height="9*"/>
            <RowDefinition Height="1*"/>
        <Label Content="Hello .NET Core!" HorizontalAlignment="Center" VerticalAlignment="Center"
        <Button Content="Hello Wrold" Grid.Row="1" FontSize="20" Click="Button_Click" Height="50" Width="150"/>

Open the MainWindow.xaml .cs file using this code

private void Button_Click(object sender, RoutedEventArgs e)
            MessageBox.Show(" Welcome to WPF");

You can the dotnet run command to run & see the application.