Sunday, February 17, 2008

WPF for Dummies :)

Hello everyone..

Here I am giving a very basic XAML demo, especially for those lovely developers who have not yet code a single line in XAML, and who are just aware of XAML..well..its pretty simple..If you are using Visual Studio.NET 2005, you need to Download SDK for it, If you are using Orcas/VS2008 Beta2/VS RTM..then Life is easy for you as all the stuff is built-in.

You need to choose WPF application from File-> New -> Project

This will throw you in IDE and then you need to just play in XAML tab just next to Design.


<Grid>


<Button x:Name="Vikram"
Height="50" Width="200" Content="Click">


</Button>


</Grid>


 

This will allow you to put simple button on. On similar lines you can add Textbox also, so for adding textbox,you need to write following code.


 

<TextBox x:Name="Mytxt" Height="50" Margin="39,35,39,0" VerticalAlignment="Top"></TextBox>


 

So, lets do some more fun with this..lets rotate both in 45 Degrees..so you will now have to write down the Transform for this..This is how we do it.


 

<Grid>


<Button x:Name="Vikram" Content="Click" Height="50" Width="200"
>


<Button.RenderTransform>


<RotateTransform Angle="45">


</RotateTransform>


</Button.RenderTransform>


</Button>


<TextBox x:Name="Mytxt" Height="50" Margin="39,35,39,0" VerticalAlignment="Top">


<TextBox.RenderTransform>


<RotateTransform Angle="45">


</RotateTransform>


</TextBox.RenderTransform>


</TextBox>


</Grid>


 

So..here it is..First WPF application with XAML is ready to run!!


 

Hope..you will njoy those small codes..will come up with more soon..


 

Vikram

No comments: