Go to DotNetFunda.com
 Online : 1862 |  Welcome, Guest!   Login
 
Home > Articles > WPF > My Hello World in WPF 3.5

  • Download the OOPS, ASP.NET and ADO.NET Training Videos for FREE, click here.

Submit Article | Articles Home | Search Articles |

My Hello World in WPF 3.5

 Posted on: 3/31/2009 7:01:02 AM by Vuyiswamb | Views: 4023 | Category: WPF | Level: Beginner | Print Article
Technology is growing, everyday you will hear that there is a new version of something and you will wonder if we will ever stop learning. If you are a Microsoft developer you will always buy books because almost every three or two years they bring something and when you are still busy trying to master the current technology, they introduce something new that is better than this. The gap between .net 2.0 and 3.5 was enough to allow developers to catch up. Well I got affected by that but I kept on touching the chapters of those technologies. I was impressed by all these niceties but I could not have time to explore them all. I came across a WPF and I was impressed by the UI, even if you create a small hello world. I would like to share a small hello world about WPF.

.NET Training Videos!
Buy online comprehensive training video pack just for $35.00 only, see what's inside it.

 

Introduction

Technology is growing, everyday you will hear that there is a new version of something and you will wonder if we will ever stop learning. If you are a Microsoft developer you will always buy books because almost every three or two years they bring something and when you are still busy trying to master the current technology, they introduce something new that is better than this. The gap between .net 2.0 and 3.5 was enough to allow developers to catch up. Well I got affected by that but I kept on touching the chapters of those technologies. I was impressed by all these niceties but I could not have time to explore them all. I came across a WPF and I was impressed by the UI, even if you create a small hello world. I would like to share a small hello world about WPF.

 

What is WPF

Rob Eisenberg put it clear and said Windows Presentation Foundation (hereafter referred to as WPF) is a new API for creating graphical user interfaces for the Windows platform. It is an alternative to WinForms that further empowers developers by providing an API capable of taking full advantage of the multimedia facilities of the modern PC. Unlike WinForms, it does not wrap Win32 but it is completely new, built from the ground up using .NET. The fundamental power of WPF comes from the fact that it is vector based, hardware accelerated and resolution independent.

 

Using the code

The code will be done in C#.

Start

Open your Visual studio 2008 and create a new Project and you will see a dialog like this

 

Choose WPF Application and give your project a meaningful name, mine is “Myhello_world” and click ok. At first you might get some errors on your xaml about windows tag. What you need to do is to make sure that you have imported all the required references. Check mine and compare them with yours

 

After you are done go to your window1.xaml and you will see a designer. 

 

 

 

Add a button from your toolbox and a textbox. Select the button and select its properties and in the properties go to the events and look for the click event like this

Double click and you will be sent to the code.

 

        private void button1_Click(object sender, RoutedEventArgs e)

        {

            textBox1.Text = "Hello world";

        }

 

Write your code to look like the above code. Run your Application and this is what you will see

 

 

The UI is different from the previous GUI that we used to work with in the win applications. This is only the Beginning to show you how things are in WPF. Now what could be done in web pages at ease (2D, 3D) it can be done here at ease too. Now click on the send button and you will see the following

 

 

This is not the end of what WPF can do. Check the Following examples what WPF can do

 

http://www.wpftutorial.net/ToolTip.html

 

         

Conclusion

I promise to share will share more, when I get more time to look at the nice things in wpf.

Thank you

 


If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Interesting?   Share and Bookmark this kick it on DotNetKicks.com


Experience:8 year(s)
Home page:http://www.VuyiswaMaseko.com
Member since:Sunday, July 06, 2008
Level:HonoraryPlatinum
Status: [Member] [Administrator]
Biography:Vuyiswa Junius Maseko is a programmer for ITS abacus and a moderator in ".NetFunda. Vuyiswa has been developing for 8 years now. his major strength are C# 1.1,2.0,3.0,3.5 and vb.net and sql and his interest are in asp.net, c#, smart clients, Robot Programming(embedded programming).He has been doing a lot of windows development and web development, but lately his projects are web based projects. He has been using .net since the beta version of it. Currently he works on 2.0 but has some project running on 3.5. Thanks to people like Chris Maunder (codeproject), Colin Angus Mackay (codeproject), Dave Kreskowiak (Codeproject), Sheo Narayan (.Netfunda).They have made vuyiswa what he is today.
 Latest post(s) from Vuyiswamb

   ◘ How to make your Control Always Available While Scrolling in ASP.NET AJAX posted on 3/11/2010 3:39:02 AM
   ◘ How to Write a Simple login page in Asp.net posted on 3/5/2010 5:53:22 PM
   ◘ How to Execute SSIS Packages in C# ASP.NET Part II posted on 2/24/2010 1:35:03 AM
   ◘ How to Execute SSIS Packages in C# ASP.NET - Part I posted on 2/12/2010 3:05:27 AM
   ◘ How to use Validation Controls in ASP.NET posted on 2/11/2010 8:02:52 AM


Submit Article

About Us | The Team | Advertise | Contact Us | Feedback | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found copied contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)