Windows Presentation Foundation (WPF) – Hello World :)
December 14, 2006
Hello, I’m going to write a series of articles about WPF.
This only pretend to be an introduction. I’m learning WPF as you, so feedback is welcome.
First of all, if you want to start with WPF, you must install .NET Framework 3.0 RTM and the WCF & WPF Extensions for .NET Framework 3.0 (At this moment, the last release is November 2006 CTP).
Then, you have to create a new Windows Application (WPF)
Now we have a file Window1.xaml
Replace the code with this:
<Window x:Class=”EjemplosBlog.Window1″
xmlns=”http://schemas.microsoft.com
/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com
/winfx/2006/xaml”
Title=”BlogSamples”
Height=”300″
Width=”300″>
<Grid>
<Button Name=”btnHelloWorld”
Click=”btnHelloWorld_Click”
Height=”54″
Margin=”5,5,117,0″
VerticalAlignment=”Top”>
Hello World
</Button>
</Grid>
</Window>
A quickly review:
- btnHelloWorld is the Id/Name of the button
- btnHelloWorld_Click is the name event Click
Also, add this code to the code behind (Window1.xaml.cs)
void btnHelloWorld_Click(object sender, RoutedEventArgs e)
{
btnHelloWorld.Content = “From Ezequiel
Jadib Blog”;
}
And we are ready to launch our application
I hope this is useful. Later I will post, about how we can do it the same with Triggers.
Downloads
Microsoft .NET Framework 3.0 RTM
Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF) November 2006 CTP
Resources
Introduction to Windows Presentation Foundation
Samples


October 21, 2007 at 4:36 pm
oh we didn’t care,we made it very clea. Joey Hadassah.
November 29, 2007 at 9:37 am
Finally a simple tutorial without all the nonsense not needed for hello world, thank you.
November 13, 2008 at 7:27 am
Good Work.
Really Simple.
Regards!
- Uditha