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 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"
        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:NewWPFApp"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="900">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="9*"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Label Content="Hello .NET Core!" HorizontalAlignment="Center" VerticalAlignment="Center"
               FontSize="40"/>
        <Button Content="Hello Wrold" Grid.Row="1" FontSize="20" Click="Button_Click" Height="50" Width="150"/>
    </Grid>
</Window>

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.