Create a Sample UWP App in C#

by

The core of this blog is about Microsoft Visual C#. But C# is mostly used to work with the visual Programming. Web Applications, Windows Desktop Applications, UWP Applications and so on…

So here we will practice is by using UWP Apps. The UWP is the most entrusting, simple and best way to practice visual Application build with C#.

So let’s create a UWP Project in Visual Studio with Project name “CodeRunner”.

Microsoft Visual Studio will create a Project with some prebuild files for you…

Now in the MainPage.xaml, update the Page by adding a TextBlock, two TextBlox and two Buttons, either by drag and drop from ToolBox for by adding the XAML code like here;

Now when you run the application and test it, you’ll will see the output of what you design in XAML!

Now to make the output in working, lets add some code in logical file of C#.

Create a Private Method name ‘Output’ and pass the value through that.

private void Output(string value)

        {

            txtOutput.Text += value + Environment.NewLine;

        }

Now create another method to set the logic of Clear Button;

private void ClearOutput(object sender, RoutedEventArgs e)

        {

            txtOutput.Text = “”;

        }       

So Now, when you run the application then the application will work fine as we define the logic…

So, that’s how we can develop a sample app in UWP through Visual C#.

How easy it is! Isn’t it?

FOR HANDSON DEMO

In order to get a best hands-on experience along with the Blog. Try out the code either By MSDN Code Samplesor By GitHub… : – )

Data Scientist & Solution Architect || IBM Recognised Speaker, Mentor, and Teacher || Debater || Blogger || Guinness World Record Holder || Watson Solution Developer || IBM Community Activist || Aspiring to Inspire.

Leave a Reply

Your email address will not be published.

*