<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8869049335860608066</id><updated>2012-02-16T15:40:47.227-08:00</updated><category term='Grid.RowDefinitions'/><category term='Indigo'/><category term='Text Decorations'/><category term='Parent Control'/><category term='SetValue()'/><category term='Base Line'/><category term='Grid Control'/><category term='Brush in WPF'/><category term='Over Line'/><category term='Grid.Row'/><category term='UnderLine'/><category term='Strike Through'/><category term='ColumnDefinition'/><category term='Brushes'/><category term='WindowsPresentationFoundation'/><category term='SolidColorBrush Solid Color Brush'/><category term='Grid.SetColumn()'/><category term='GridLength'/><category term='GridUnitType'/><category term='Brush'/><category term='XAML'/><category term='RowDefinition'/><category term='LinearGradientBrush'/><category term='Windows Presentation Foundation'/><category term='Gridcontrol'/><category term='Linear Gradient Brush'/><category term='Canvas'/><category term='RadialGradientBrush'/><category term='Brushes in WPF'/><category term='Canvas.Top'/><category term='Parent'/><category term='Canvas.Left'/><category term='Container'/><category term='Grid.SetRow()'/><category term='ImageBrush Image Brush'/><category term='Grid'/><category term='Grid.Column'/><category term='Grid.ColumnDefinitions'/><category term='WPF'/><category term='Brush WPF'/><title type='text'>.Net Framework 3.5</title><subtitle type='html'>This blog is about .Net Framework 3.5 Components. It focuses mainly on WPF (Windows Communication Foundation) and WCF (Windows Communication Foundation). This blog would be very useful for the beginners as well as users having some experience in .Net 2.0 Technology. Only Theories can not help you understand the functionalities of new Technologies so I have provided some basic program codes for your better understandings, so that you can have some hands on experience too in WPF and WCF.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blogonwpfwcf.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blogonwpfwcf.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Raxit Thakkar</name><uri>http://www.blogger.com/profile/14162132514154432483</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_BcaDO8hyhy8/S-OwhJ7-K7I/AAAAAAAAAEw/-MGhEmSLT50/S220/Rax4.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8869049335860608066.post-1445482445242753404</id><published>2009-02-26T02:04:00.000-08:00</published><updated>2009-02-26T03:38:41.889-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Brush in WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Linear Gradient Brush'/><category scheme='http://www.blogger.com/atom/ns#' term='RadialGradientBrush'/><category scheme='http://www.blogger.com/atom/ns#' term='LinearGradientBrush'/><category scheme='http://www.blogger.com/atom/ns#' term='XAML'/><category scheme='http://www.blogger.com/atom/ns#' term='Brushes in WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='ImageBrush Image Brush'/><category scheme='http://www.blogger.com/atom/ns#' term='Brushes'/><category scheme='http://www.blogger.com/atom/ns#' term='Brush WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='SolidColorBrush Solid Color Brush'/><category scheme='http://www.blogger.com/atom/ns#' term='Brush'/><title type='text'>Brushes In WPF</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Brush ( Part -1 )&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;Hey Guys!! This post will help you to learn about different types of brushes in WPF. Using brushes one can apply different patterns and colours to the background and foreground of the controls in WPF. In this post we will see how to create different fill patterns using brushes to apply them in some controls.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;It is not much fun to use only one color in the background of a page. You might have seen lots of websites having attractive or flashy backgrounds. Before WPF came in the market, .Net deveopers used to take some help of flash, photoshop or some other tools to create images those can be used as backgrounds for the page. But, .Net 3.5 provides very easy way of creating such flashy or attractive colors to your application. One can use animations and different shapes also to add beauty to your application. We will cover shapes and animation in next posts. Let's now concentrate on how we can use Brushes to make our application more attractive. There are mainly six types of brushes in WPF.&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;div align="justify"&gt;SolidColorBrush&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;LinearGradientBrush &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;RadialGradientBrush&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;DrawingBrush&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;ImageBrush&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;VisualBrush&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p align="justify"&gt;We will see first three in detail in this post. Let's start it one by one.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;strong&gt;(1) SolidColorBrush&lt;/strong&gt; - In previous post we have learned how to add canvas. We will apply some background color for it. Here is a code that will set background color "AliceBlue".&lt;br/&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;XAML Code:&lt;/p&gt;&lt;p align="justify"&gt;&amp;lt;Canvas Name="cnvPaint" Height="700" Width="700"&gt;&lt;br /&gt;&amp;lt;Canvas.Background&gt;&lt;br /&gt;&amp;lt;SolidColorBrush Color="AliceBlue"/&gt;&lt;br /&gt;&amp;lt;/Canvas.Background&gt;&lt;br /&gt;&amp;lt;/Canvas&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;C# Code:&lt;/p&gt;&lt;p align="justify"&gt;SolidColorBrush s = new SolidColorBrush(Colors.Blue);&lt;br /&gt;cnvMain.Background = s;&lt;/p&gt;&lt;p align="justify"&gt;OR&lt;/p&gt;&lt;p align="justify"&gt;cnvMain.Background = new SolidColorBrush(Colors.Blue);&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;As you can see in above C# code, we can use some of the basic colors from Colors class. We can create our own brush and can set some appropriate properties .&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;From here on, we will have only XAML code. I think, you can write C# code by your self now. You just have to create object of the brush you want to use and can set the same properties shown in XAML code for that object and can use you brush at run time.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;strong&gt;(2) LinearGradientBrush&lt;/strong&gt; - The following piece of code shows how one can add LinearGradientBrush. Just copy and paste it to see the magic!!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;XAML Code:&lt;/p&gt;&lt;p align="justify"&gt;&amp;lt;Rectangle Height="150" Width="150"&gt;&lt;br /&gt;&amp;lt;Rectangle.Fill&gt;&lt;br /&gt;&amp;lt;LinearGradientBrush StartPoint="0,1" EndPoint="0,0"&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Black" Offset="0.15"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.30"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Red" Offset="0.45"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Yellow" Offset="0.60"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Brown" Offset="0.75"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="CadetBlue" Offset="0.90"/&gt;&lt;br /&gt;&amp;lt;/LinearGradientBrush&gt;&lt;br /&gt;&amp;lt;/Rectangle.Fill&gt;&lt;br /&gt;&amp;lt;/Rectangle&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;XAML Code:&lt;/p&gt;&lt;p align="justify"&gt;&amp;lt;Rectangle Canvas.Left="160" Height="150" Width="150"&gt;&lt;br /&gt;&amp;lt;Rectangle.Fill&gt;&lt;br /&gt;&amp;lt;LinearGradientBrush StartPoint="1,1" EndPoint="0,0"&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Black" Offset="0.005"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.010"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Black" Offset="0.015"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.020"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Black" Offset="0.025"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.030"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Black" Offset="0.035"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.50"/&gt;&lt;br /&gt;&amp;lt;/LinearGradientBrush&gt;&lt;br /&gt;&amp;lt;/Rectangle.Fill&gt;&lt;br /&gt;&amp;lt;/Rectangle&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;You can change the value for starrt point and end point to see the change. use {(0,1),(0,0)}, {(0,0),(1,1)} etc.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;strong&gt;(3) RadialGradientBrush&lt;/strong&gt; - The following piece of code shows how one can add RadialGradientBrush. Just copy and paste it to see the magic!!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;XAML Code:&lt;/p&gt;&lt;br /&gt;&lt;p align="justify"&gt;&amp;lt;Rectangle Canvas.Top="160" Canvas.Left="160" Height="150" Width="150"&gt;&lt;br /&gt;&amp;lt;Rectangle.Fill&gt;&lt;br /&gt;&amp;lt;RadialGradientBrush Center="0,0" GradientOrigin="1,1" &gt;&lt;br /&gt;&amp;lt;GradientStop Color="Red" Offset="0.0"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.10"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Blue" Offset="0.20"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.30"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Black" Offset="0.40"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.50"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="BurlyWood" Offset="0.60"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.70"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Red" Offset="0.80"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="White" Offset="0.90"/&gt;&lt;br /&gt;&amp;lt;GradientStop Color="Red" Offset="1.00"/&gt;&lt;br /&gt;&amp;lt;/RadialGradientBrush&gt;&lt;br /&gt;&amp;lt;/Rectangle.Fill&gt;&lt;br /&gt;&amp;lt;/Rectangle&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;HAPPY CODING!!&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8869049335860608066-1445482445242753404?l=blogonwpfwcf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blogonwpfwcf.blogspot.com/feeds/1445482445242753404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/02/brushes-in-wpf.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/1445482445242753404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/1445482445242753404'/><link rel='alternate' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/02/brushes-in-wpf.html' title='Brushes In WPF'/><author><name>Raxit Thakkar</name><uri>http://www.blogger.com/profile/14162132514154432483</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_BcaDO8hyhy8/S-OwhJ7-K7I/AAAAAAAAAEw/-MGhEmSLT50/S220/Rax4.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8869049335860608066.post-7861867404973090093</id><published>2009-02-09T20:54:00.000-08:00</published><updated>2009-02-09T23:06:19.062-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Parent Control'/><category scheme='http://www.blogger.com/atom/ns#' term='GridLength'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid.SetColumn()'/><category scheme='http://www.blogger.com/atom/ns#' term='GridUnitType'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid.RowDefinitions'/><category scheme='http://www.blogger.com/atom/ns#' term='XAML'/><category scheme='http://www.blogger.com/atom/ns#' term='Indigo'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid.Column'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid.ColumnDefinitions'/><category scheme='http://www.blogger.com/atom/ns#' term='Gridcontrol'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid.Row'/><category scheme='http://www.blogger.com/atom/ns#' term='RowDefinition'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Presentation Foundation'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid.SetRow()'/><category scheme='http://www.blogger.com/atom/ns#' term='Parent'/><category scheme='http://www.blogger.com/atom/ns#' term='Grid Control'/><category scheme='http://www.blogger.com/atom/ns#' term='ColumnDefinition'/><category scheme='http://www.blogger.com/atom/ns#' term='WindowsPresentationFoundation'/><title type='text'>Grid In WPF</title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;color:#6600cc;"&gt;Container (Grid Control)&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="color:#6600cc;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;color:#000000;"&gt;Before you really start working in WPF you first should be aware of the controls those are used as container controls in WPF. Actually, each and every control in WPF is a container control. But &lt;strong&gt;Grid&lt;/strong&gt; and Canvas are the two main controls those are used as container in most of the cases. This section will explain about &lt;strong&gt;Grid&lt;/strong&gt; control in detail.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#3366ff;"&gt;&lt;strong&gt;Grid Control&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;Like all other controls, &lt;strong&gt;Grid&lt;/strong&gt; is a container control in WPF. It can have 'n' number of children of it. If you have added Buttons, TextBlocks, Textboxes or any other controls inside &lt;strong&gt;Grid&lt;/strong&gt; then those controls are children of &lt;strong&gt;Grid&lt;/strong&gt;, at the same time one can say that &lt;strong&gt;Grid&lt;/strong&gt; is a parent control for them. Compared to Canvas, &lt;strong&gt;Grid&lt;/strong&gt; control is diffrent. For the proper layout and positioning of child controls in grid, we can devide &lt;strong&gt;Grid Control&lt;/strong&gt; in set of Rows and Columns. Just like "Table" control in HTML. We have to define RowDefinitions and ColumnDefinition for the &lt;strong&gt;Grid&lt;/strong&gt;. Let's just start it, then only we will have better idea. First of all try to add &lt;strong&gt;Grid&lt;/strong&gt; in your XAML code, and to do that, use the following piece of code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;Grid Name="grMain" Height="500" Width="600" Background="Orange"&gt;&lt;br /&gt;&amp;lt;/Grid&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Grid grMain = new Grid();&lt;br /&gt;grMain.Height = 500;&lt;br /&gt;grMain.Width = 600;&lt;br /&gt;grMain.Background = new SolidColorBrush(Colors.Orange);&lt;br /&gt;&lt;br /&gt;since, page does not have children property, add above &lt;strong&gt;Grid&lt;/strong&gt; in the page using following Code.&lt;br /&gt;&lt;br /&gt;pgMain.Content = grMain;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Great!!, we have added a &lt;strong&gt;Grid&lt;/strong&gt; control in Page. Now what? It's time to add child controls inside the &lt;strong&gt;Grid&lt;/strong&gt;. But, wait a minute. Before jumping into a swimming pool, we must check weather it's full of water or not right? same is the case with Grid. If you want to add controls inside a &lt;strong&gt;Grid&lt;/strong&gt;, better checkout weather you have defined RowDefinitions and ColumnDefinitions for the &lt;strong&gt;Grid&lt;/strong&gt; or not. &lt;br /&gt;&lt;br /&gt;You can add RowDefinitions using the following piece of code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;Grid.RowDefinitions&gt;&lt;br /&gt;            &amp;lt;RowDefinition Height="50"/&gt;&lt;br /&gt;            &amp;lt;RowDefinition Height="100"/&gt;&lt;br /&gt;            &amp;lt;RowDefinition Height="*"/&gt;&lt;br /&gt;&amp;lt;/Grid.RowDefinitions&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;RowDefinition r = new RowDefinition();&lt;br /&gt;r.Height = new GridLength(50, GridUnitType.Pixel);&lt;br /&gt;&lt;br /&gt;RowDefinition r1 = new RowDefinition();&lt;br /&gt;r1.Height = new GridLength(100, GridUnitType.Pixel);&lt;br /&gt;&lt;br /&gt;RowDefinition r2 = new RowDefinition();&lt;br /&gt;r2.Height = new GridLength(0, GridUnitType.Star);&lt;br /&gt;&lt;br /&gt;Create RowDefinitions like this, then use following piece of code to add these RowDefinitions in the &lt;strong&gt;Grid Control&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;grMain.RowDefinitions.Add(r);&lt;br /&gt;grMain.RowDefinitions.Add(r1);&lt;br /&gt;grMain.RowDefinitions.Add(r2);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Here "grMain" is the Name of the &lt;strong&gt;Grid Control&lt;/strong&gt;. Run the application, you would not be able to see the space(Height) acuired by these Rows. To check that, add ShowGridlines="True" in your XAML code or add &lt;strong&gt;grMain.ShowGridLines = true;&lt;/strong&gt; in your code behind file.&lt;br /&gt;&lt;br /&gt;That's how we can Devide Grid into set of Rows. Same like this, devide &lt;strong&gt;Grid Control&lt;/strong&gt; into set of columns. To do this, use the followin piece of code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;Grid.ColumnDefinitions&gt;&lt;br /&gt;            &amp;lt;ColumnDefinition Height="50"/&gt;&lt;br /&gt;            &amp;lt;ColumnDefinition Height="100"/&gt;&lt;br /&gt;            &amp;lt;ColumnDefinition Height="*"/&gt;&lt;br /&gt;&amp;lt;/Grid.ColumnDefinitions&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;ColumnDefinition c = new ColumnDefinition();&lt;br /&gt;c.Width = new GridLength(50, GridUnitType.Pixel);&lt;br /&gt;&lt;br /&gt;ColumnDefinition c1 = new ColumnDefinition();&lt;br /&gt;c1.Width = new GridLength(100, GridUnitType.Pixel);&lt;br /&gt;&lt;br /&gt;ColumnDefinition c2 = new ColumnDefinition();&lt;br /&gt;c2.Width = new GridLength(0, GridUnitType.Star);&lt;br /&gt;&lt;br /&gt;grMain.ColumnDefinitions.Add(c);&lt;br /&gt;grMain.ColumnDefinitions.Add(c1);&lt;br /&gt;grMain.ColumnDefinitions.Add(c2);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, our &lt;strong&gt;Grid Control&lt;/strong&gt; is ready with three Rows and three Columns. You can add as many Rows or Columns as you want. One thing you must remember is, you have to set &lt;strong&gt;"Height"&lt;/strong&gt; property for &lt;strong&gt;Rows&lt;/strong&gt; and &lt;strong&gt;"Width"&lt;/strong&gt; property for &lt;strong&gt;Columns&lt;/strong&gt;. Let's add some controls inside the &lt;strong&gt;Grid&lt;/strong&gt; control now. Let's add few TextBlocks to have a clear idea.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;TextBlock Name="tbID" Height="30" Width="50" Grid.Column="0" Grid.Row="0"&gt;ID&amp;lt;/TextBlock&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;TextBlock Name="tbName" Height="30" Width="70" Grid.Column="1" Grid.Row="0"&gt;Name&amp;lt;/TextBlock&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;TextBlock Name="tbAddress" Height="30" Width="100" Grid.Column="2" Grid.Row="0"&gt;Address&amp;lt;/TextBlock&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What do we see here? Something new? right, two new properties &lt;strong&gt;Grid.Row&lt;/strong&gt; and &lt;strong&gt;Grid.Column&lt;/strong&gt;. These two properties define, in which Row and Column, this TextBlock control should be placed inside the &lt;strong&gt;Grid&lt;/strong&gt;. To add it in 1st Row we must set Grid.Row="0". Same applies for the column also. Here is an example, how you can add button at runtime using C# code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Button btnSubmit = new Button();&lt;br /&gt;btnSubmit.Height = 30;&lt;br /&gt;btnSubmit.Width = 50;&lt;br /&gt;btnSubmit.Content = "Submit";&lt;br /&gt;Grid.SetColumn(btnSubmit, 0);&lt;br /&gt;Grid.SetRow(btnSubmit, 2);&lt;br /&gt;grMain.Children.Add(btnSubmit);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;As you can see here, to set Row and Column for a control at runtime we must use Grid.SetColumn() and Grig.SetRow(). As a first argument in this function we have to pass the "Name" of the control and second argument is Row or Column number. Likewise we can add 'n' number of children in the &lt;strong&gt;Grid Control.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Here is the final XAML code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;Page x:Class="WpfBrowserApplication1.Page1"&lt;br /&gt;    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;    Title="pgMain" Loaded="pgMain_Loaded"&gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;Grid Name="grMain" Height="500" Width="600" Background="Orange" &gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;Grid.RowDefinitions&gt;&lt;br /&gt;            &amp;lt;RowDefinition Height="50"/&gt;&lt;br /&gt;            &amp;lt;RowDefinition Height="100"/&gt;&lt;br /&gt;            &amp;lt;RowDefinition Height="*"/&gt;&lt;br /&gt;        &amp;lt;/Grid.RowDefinitions&gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;Grid.ColumnDefinitions&gt;&lt;br /&gt;            &amp;lt;ColumnDefinition Width="50"/&gt;&lt;br /&gt;            &amp;lt;ColumnDefinition Width="100"/&gt;&lt;br /&gt;            &amp;lt;ColumnDefinition Width="*"/&gt;&lt;br /&gt;        &amp;lt;/Grid.ColumnDefinitions&gt;&lt;br /&gt;        &lt;br /&gt;        &amp;lt;TextBlock Name="tbID" Height="30" Width="50" Grid.Column="0" Grid.Row="0"&gt;ID&amp;lt;/TextBlock&gt;&lt;br /&gt;        &amp;lt;TextBlock Name="tbName" Height="30" Width="50" Grid.Column="1" Grid.Row="0"&gt;Name&amp;lt;/TextBlock&gt;&lt;br /&gt;        &amp;lt;TextBlock Name="tbAddress" Height="30" Width="50" Grid.Column="2" Grid.Row="0"&gt;Address&amp;lt;/TextBlock&gt;&lt;br /&gt;        &lt;br /&gt;    &amp;lt;/Grid&gt;&lt;br /&gt;&amp;lt;/Page&gt;&lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;HAPPY CODING!!&lt;br /&gt;&lt;hr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8869049335860608066-7861867404973090093?l=blogonwpfwcf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blogonwpfwcf.blogspot.com/feeds/7861867404973090093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/02/grid-in-wpf.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/7861867404973090093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/7861867404973090093'/><link rel='alternate' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/02/grid-in-wpf.html' title='Grid In WPF'/><author><name>Raxit Thakkar</name><uri>http://www.blogger.com/profile/14162132514154432483</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_BcaDO8hyhy8/S-OwhJ7-K7I/AAAAAAAAAEw/-MGhEmSLT50/S220/Rax4.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8869049335860608066.post-2249291498086307850</id><published>2009-02-02T00:30:00.000-08:00</published><updated>2009-02-09T20:50:58.512-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Container'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Presentation Foundation'/><category scheme='http://www.blogger.com/atom/ns#' term='Canvas.Top'/><category scheme='http://www.blogger.com/atom/ns#' term='SetValue()'/><category scheme='http://www.blogger.com/atom/ns#' term='Canvas'/><category scheme='http://www.blogger.com/atom/ns#' term='WindowsPresentationFoundation'/><category scheme='http://www.blogger.com/atom/ns#' term='Canvas.Left'/><title type='text'>Canvas In WPF</title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;color:#6600cc;"&gt;Container (Canvas)&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#6600cc;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;color:#000000;"&gt;Before you really start working in WPF you first should be aware of the controls those are used as container controls in WPF. Actually, each and every control in WPF is a container control. But &lt;strong&gt;Canvas&lt;/strong&gt; and Grid are the two main controls those are used as container in most of the cases. This section will explain about &lt;strong&gt;Canvas&lt;/strong&gt; control in detail.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#3366ff;"&gt;&lt;strong&gt;Canvas&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;Like all other controls, &lt;strong&gt;Canvas&lt;/strong&gt; is a container control in WPF. It can have 'n' number of children of it. If you have added Buttons, TextBlocks, Textboxes or any other controls inside &lt;strong&gt;Canvas&lt;/strong&gt; then those controls are children of canvas, at the same time one can say that &lt;strong&gt;Canvas&lt;/strong&gt; is a parent control for them. To add a &lt;strong&gt;Canvas&lt;/strong&gt; in your XAML code, use the following piece of code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;Canvas Name="cnvMain" Background="Red" Height="300" Width="300"&gt;&lt;br /&gt;&amp;lt;/Canvas&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;Canvas cnvMain = New Canvas();&lt;br /&gt;cnvMain.Height = 300;&lt;br /&gt;cnvMain.Width = 300;&lt;br /&gt;cnvMain.Background = New SolidColorBrush(Colors.Red);&lt;br /&gt;&lt;br /&gt;since, page does not have children property, add above Canvas in the page using following Code.&lt;br /&gt;&lt;br /&gt;pgMain.Content = cnvMain;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you have used canvas as a container control, all the controls those are added as child controls of &lt;strong&gt;Canvas&lt;/strong&gt; should have main two properties. &lt;br /&gt;&lt;br /&gt;1) Canvas.Top&lt;br /&gt;2) Canvas.Left&lt;br /&gt;&lt;br /&gt;These two properties are used for the proper positioning of the controls which are inside the &lt;strong&gt;Canvas&lt;/strong&gt;. These properties (Left and Top) are related to the parent canvas for any control. An example will help you understand this easily.&lt;br /&gt;&lt;br /&gt;If you want to add a TextBlock inside the canvas, you can add it using Following Code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code:&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;Canvas Name="cnvMain" Background="Red" Height="300" Width="300"&gt;&lt;br /&gt;&amp;lt;TextBlock Name="tbTest" Height="40" Width="100" Text="Hello"&gt;&lt;br /&gt;&amp;lt;/TextBlock&gt;&lt;br /&gt;&amp;lt;/Canvas&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code:&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;TextBlock tbTest = new TextBlock();&lt;br /&gt;tbTest.Height = 40;&lt;br /&gt;tbTest.Width = 100;&lt;br /&gt;tbTest.Text = "Hello";&lt;br /&gt;cnvMain.Children.Add(tbTest);&lt;br /&gt;&lt;br /&gt;Check output of the above code. You will see that TextBlock having Text "Hello" Would appear in the Top Left Corner of the &lt;strong&gt;Canvas&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Now, if you want to set the position of this control inside the &lt;strong&gt;Canvas&lt;/strong&gt;, you can use Canvas.Left and Canvas.Top property in the XAML code. If you want to set these properties runtime then, you must use following piece of code for that,&lt;br /&gt;&lt;br /&gt;tbTest.SetValue(Canvas.LeftProperty, 30.0);&lt;br /&gt;tbTest.SetValue(Canvas.TopProperty, 100.0);&lt;br /&gt;&lt;br /&gt;These properties are Attached or dependent properties, means those are dependent upon their parent control. To set such properties we should use, SetValue() function.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;These are some of the basic properties. You can use properties which are useful for you. One very important feature provided by Visual Studio is &lt;strong&gt;intellisence&lt;/strong&gt;. Use it and explore the properties related to the controls.&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8869049335860608066-2249291498086307850?l=blogonwpfwcf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blogonwpfwcf.blogspot.com/feeds/2249291498086307850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/02/canvas-in-wpf.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/2249291498086307850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/2249291498086307850'/><link rel='alternate' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/02/canvas-in-wpf.html' title='Canvas In WPF'/><author><name>Raxit Thakkar</name><uri>http://www.blogger.com/profile/14162132514154432483</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_BcaDO8hyhy8/S-OwhJ7-K7I/AAAAAAAAAEw/-MGhEmSLT50/S220/Rax4.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8869049335860608066.post-4748748955188412990</id><published>2009-01-28T22:39:00.000-08:00</published><updated>2009-02-09T20:50:58.513-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Over Line'/><category scheme='http://www.blogger.com/atom/ns#' term='Strike Through'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Presentation Foundation'/><category scheme='http://www.blogger.com/atom/ns#' term='Base Line'/><category scheme='http://www.blogger.com/atom/ns#' term='Text Decorations'/><category scheme='http://www.blogger.com/atom/ns#' term='WindowsPresentationFoundation'/><category scheme='http://www.blogger.com/atom/ns#' term='UnderLine'/><title type='text'>WPF Text Decorations</title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;color:#6600cc;"&gt;Text Decorations : &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#6600cc;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;color:#000000;"&gt;Your Web page looks more attractive if it contains some decorative text. No one would like to read the contents those are not properly decorated. Some times you need to highlight a word or you want to make a word look little different than the other words on your page. Here are some examples that would help you to make your text decorative in WPF. You can do some &lt;strong&gt;Text decorations&lt;/strong&gt; like Underline, StrikeThrough, Over Line, Base Line in WPF. This blogs shows how you can apply these different &lt;strong&gt;Text decorations&lt;/strong&gt; to your web page. To understand all these you must have some idea about TextBlock Control. TextBlock Control is a lightweight control for displaying small amount of float content. You can drag and drop it from toolbox. You can decorate the text using XAML code and setting the property of it. You can also set the &lt;strong&gt;Text Decoration&lt;/strong&gt; style from code bihind file also. Here I have provided both ways of doing. Use what ever is convenient for you.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#3366ff;"&gt;&lt;strong&gt;Apply UnderLine :&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code :&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;TextBlock TextDecorations="UnderLine" VerticalAlignment="Center" HorizontalAlignment="Center" Name="tbTest"&gt;&lt;br /&gt;&lt;strong&gt;Text Decorations&lt;/strong&gt;&lt;br /&gt;&amp;lt;/TextBlock&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code :&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;tbTest.TextDecorations = TextDecorations.UnderLine;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#3366ff;"&gt;&lt;strong&gt;Apply OverLine :&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code :&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;TextBlock TextDecorations="Overline" VerticalAlignment="Center" HorizontalAlignment="Center" Name="tbTest"&gt;&lt;br /&gt;&lt;strong&gt;Text Decorations&lt;/strong&gt;&lt;br /&gt;&amp;lt;/TextBlock&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code :&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;tbTest.TextDecorations = TextDecorations.Overline;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#3366ff;"&gt;&lt;strong&gt;Apply BaseLine :&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code :&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;TextBlock TextDecorations="Baseline" VerticalAlignment="Center" HorizontalAlignment="Center" Name="tbTest"&gt;&lt;br /&gt;&lt;strong&gt;Text Decorations&lt;/strong&gt;&lt;br /&gt;&amp;lt;/TextBlock&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code :&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;tbTest.TextDecorations = TextDecorations.Baseline;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#3366ff;"&gt;&lt;strong&gt;Apply Strikethrough :&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;em&gt;&lt;strong&gt;XAML Code :&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&amp;lt;TextBlock TextDecorations="Strikethrough" VerticalAlignment="Center" HorizontalAlignment="Center" Name="tbTest"&gt;&lt;br /&gt;&lt;strong&gt;Text Decorations&lt;/strong&gt;&lt;br /&gt;&amp;lt;/TextBlock&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;color:#9999ff;"&gt;&lt;strong&gt;&lt;em&gt;C# Code :&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;tbTest.TextDecorations = TextDecorations.Strikethrough;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8869049335860608066-4748748955188412990?l=blogonwpfwcf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blogonwpfwcf.blogspot.com/feeds/4748748955188412990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/01/wpf-text-decorations.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/4748748955188412990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/4748748955188412990'/><link rel='alternate' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/01/wpf-text-decorations.html' title='WPF Text Decorations'/><author><name>Raxit Thakkar</name><uri>http://www.blogger.com/profile/14162132514154432483</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_BcaDO8hyhy8/S-OwhJ7-K7I/AAAAAAAAAEw/-MGhEmSLT50/S220/Rax4.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8869049335860608066.post-5166802137364376806</id><published>2009-01-27T22:10:00.000-08:00</published><updated>2009-02-09T20:50:58.514-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Presentation Foundation'/><category scheme='http://www.blogger.com/atom/ns#' term='XAML'/><category scheme='http://www.blogger.com/atom/ns#' term='Indigo'/><category scheme='http://www.blogger.com/atom/ns#' term='WindowsPresentationFoundation'/><title type='text'>WPF ( Windows Presentation Foundation )</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;As a Beginner when I heard about &lt;strong&gt;WPF&lt;/strong&gt;, I heard that &lt;strong&gt;WPF&lt;/strong&gt; in near future would steal whole market for creating Web as well as Windows applications. I was very excited and searched loads of websites to learn WPF but did not got a short cut to learn it. Some sites provided basic info like full form of it and some provided hi-fi examples. Finally I realized that it is really very tough to learn the technology that is very new and does not have many tutorials on the web. If you want to learn WPF, you must go through all the sample codes available in SDK itself.&lt;br /&gt;&lt;br /&gt;One of today’s buzzword is &lt;strong&gt;WPF&lt;/strong&gt; ( Windows Presentation Foundation ) code named Avalon. It is one of the basic component of .Net Framework 3.5. &lt;strong&gt;WPF&lt;/strong&gt; is a set of libraries used to build, execute and manage both Windows and Web based applications. If you are familiar with .Net Framework and HTML then, .Net Framework would not be much demanding for you.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;.Net Framework 3.5 = .Net Framework 2.0 + WPF + WCF + WC + WF + LINQ&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To learn &lt;strong&gt;WPF&lt;/strong&gt; one must learn &lt;strong&gt;XAML&lt;/strong&gt; (eXtensible Application Markup Language) first because, as ASP.NET is used to design the web pages in .Net 2.0, &lt;strong&gt;XAML&lt;/strong&gt; is used to design the pages in &lt;strong&gt;WPF&lt;/strong&gt;. &lt;strong&gt;XAML&lt;/strong&gt; is based on XML. It is a new description programming language designed by Microsoft to design UI (User Interface) for the managed applications. &lt;strong&gt;XAML&lt;/strong&gt; is used to display the controls on the webpage for &lt;strong&gt;WPF&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Every Control in &lt;strong&gt;WPF&lt;/strong&gt; is a container. Means now, you can add images to the Lables also. You might have ssen some List boxes having list items with not only the text but with some images also. This can be achieved with the help of WPF now. Lets have some hands on experience in WPF. For that you must have Visual Studio 2008 or if you have Visual Studio 2005 on your machine then you must download .NET 3.0 SDK. You can find this on microsoft download site.&lt;br /&gt;&lt;br /&gt;If you have visual studio 2008 installed on your computer you can start creating some applications in it. For that you have to go to File &gt; New &gt; Project&lt;br /&gt;&lt;br /&gt;Here you can see there are two options available for WPF.&lt;br /&gt;(1) WPF Application ( Window )&lt;br /&gt;(2) WPF Browser Application ( Web )&lt;br /&gt;&lt;br /&gt;You can select any of these two as per your requirement. If you select Window Application you will have 2 pages named App and Window1 added default in your solution and if you select Web Application you will have 2 pages named App and Page1 added default in your solution . As you can see for each page there would be 2 files .xaml and .xaml.cs (.cs here stands for c# file. If you will select vb as a language then the file name would be .xaml.vb. ).&lt;br /&gt;&lt;br /&gt;The first file .xaml is a design file and .xaml.cs is a code behind file. For .Net Framework 2.0 we have the file named .aspx and .aspx.cs. Here XAML is used to design the pages.&lt;br /&gt;XAML stands for eXtensible Application Markup Language. It is very much same as HTML. Like HTML, XAML is used to represent the data.&lt;br /&gt;&lt;br /&gt;We take an example of a Web Application. App page is know as Application page. In App.xaml page you can find a property named "&lt;strong&gt;StartupUri&lt;/strong&gt;" that is used to set the start page of the application. Another page would be Page1. You will find a Grid control as a default control in the page. Other than grid one can use Canvas or Stack Panel as a container control also. We will keep Grid as a Parent control for our example. Now, Let us try to add a button control in the webpage. To add it in .xaml file you can drag and drop the Button control inside the Grid from the toolbox . You can set some properties of the control as per your choice. After adding a button in page1.xaml your page code might look like this,&lt;br /&gt;&lt;br /&gt;&amp;lt;Page x:Class="WpfBrowserApplication1.Page1"&lt;br /&gt;xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br /&gt;xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;Title="Page1" Loaded="Page_Loaded"&gt;&lt;br /&gt;&amp;lt;grid name="grd"&gt;&lt;br /&gt;&amp;lt;button name="button1" width="75" height="30"&gt;Click Here&amp;lt;/button&gt;&lt;br /&gt;&amp;lt;/grid&gt;&lt;br /&gt;&amp;lt;/Page&gt;&lt;br /&gt;&lt;br /&gt;One can set the Name property of the controls, we set Name property of a grid to "grd". After setting name property, one can use that control in the code behind file.&lt;br /&gt;&lt;br /&gt;To add a button to the webpage using a c# code use the following code.&lt;br /&gt;&lt;br /&gt;Button button1 = new Button();&lt;br /&gt;button1.Content = "Click Me";&lt;br /&gt;button1.Height = 30;&lt;br /&gt;button1.Width = 75;&lt;br /&gt;grd.Children.Add(button1);&lt;br /&gt;&lt;br /&gt;Build your application and run. That would display the button on a Webpage having "Click Me" written on it as shown below.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;button name="button1" height="30" width="75"&gt;Click Here&lt;/button&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;HAPPY CODING!!&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8869049335860608066-5166802137364376806?l=blogonwpfwcf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blogonwpfwcf.blogspot.com/feeds/5166802137364376806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/01/wpf-windows-presentation-foundation.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/5166802137364376806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8869049335860608066/posts/default/5166802137364376806'/><link rel='alternate' type='text/html' href='http://blogonwpfwcf.blogspot.com/2009/01/wpf-windows-presentation-foundation.html' title='WPF ( Windows Presentation Foundation )'/><author><name>Raxit Thakkar</name><uri>http://www.blogger.com/profile/14162132514154432483</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_BcaDO8hyhy8/S-OwhJ7-K7I/AAAAAAAAAEw/-MGhEmSLT50/S220/Rax4.jpg'/></author><thr:total>4</thr:total></entry></feed>
