<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8422996711799977570</atom:id><lastBuildDate>Thu, 19 Jan 2012 11:38:00 +0000</lastBuildDate><category>Interoperability</category><category>Vista</category><category>Template</category><category>MVVM</category><category>Performance</category><category>Path</category><category>DataTemplate</category><category>WPF3D</category><category>Bug</category><category>BitmapEffect</category><category>Surface Tag</category><category>Lambda Expressions</category><category>XBAP</category><category>XAML</category><category>Dependency Property</category><category>XAML 2009</category><category>WPF Training</category><category>.Net 3.5</category><category>Design Time</category><category>Debugging</category><category>Surface</category><category>Visual Tree</category><category>INotifyPropertyChanged</category><category>Surface Development</category><category>Application Architecture</category><category>Surface IdentityTag</category><category>Style</category><category>OpacityMask</category><category>Blend</category><category>Windows Forms</category><category>Interactions</category><category>Pixel Shader Effects</category><category>Controls</category><category>Transform</category><category>Triggers</category><category>.Net 4</category><category>Tips</category><category>Microsoft Surface</category><category>C#</category><category>Attached Event</category><category>Behaviors</category><category>Surface simulator</category><category>Custom Controls</category><category>Markup extension</category><category>Mediator Pattern</category><category>WCF</category><category>Linq</category><category>Common Code Base</category><category>Databinding</category><category>Linux</category><category>MCTS</category><category>Visual State Manager</category><category>WPF</category><category>Books</category><title>Joymon's world of WPF</title><description>&lt;p&gt;Abt me :Now a mad rider on the WPF road&lt;/p&gt;</description><link>http://joyfulwpf.blogspot.com/</link><managingEditor>noreply@blogger.com (Joy George)</managingEditor><generator>Blogger</generator><openSearch:totalResults>99</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Joyfulwpf" /><feedburner:info uri="joyfulwpf" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-605628409758102047</guid><pubDate>Sun, 18 Sep 2011 16:42:00 +0000</pubDate><atom:updated>2011-09-18T22:12:08.440+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>WPF 4.5 New features</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/bb613588(v=vs.110).aspx"&gt;http://msdn.microsoft.com/en-us/library/bb613588(v=vs.110).aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Its sad to say that,I can't find much interesting features.&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-605628409758102047?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-t5fM7aenDkw2LtzA7NR0YGVTH4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-t5fM7aenDkw2LtzA7NR0YGVTH4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-t5fM7aenDkw2LtzA7NR0YGVTH4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-t5fM7aenDkw2LtzA7NR0YGVTH4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/Q85lNGt7mmw/wpf-45-new-features.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2011/09/wpf-45-new-features.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-1648360476032574993</guid><pubDate>Mon, 08 Aug 2011 08:18:00 +0000</pubDate><atom:updated>2011-08-08T13:50:06.867+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Dependency Property</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><title>How dependency property internally works? A MUST read for WPF and Silverlight developers</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
A good article which I though of writing when I started WPF. This describes how dependency property concept is implemented on top of .Net 2.0 framework without even adding a .net language keyword.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.abhisheksur.com/2011/07/internals-of-dependency-property-in-wpf.html"&gt;http://www.abhisheksur.com/2011/07/internals-of-dependency-property-in-wpf.html&lt;/a&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;A MUST read for WPF and Silverlight developers before they actually write code for clients&lt;/b&gt;.&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-1648360476032574993?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pNWx4J1VbEDKm9mNO_nrhp5K9cQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pNWx4J1VbEDKm9mNO_nrhp5K9cQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pNWx4J1VbEDKm9mNO_nrhp5K9cQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pNWx4J1VbEDKm9mNO_nrhp5K9cQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/sYMxHtX1SNc/how-dependency-property-internally.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2011/08/how-dependency-property-internally.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-5836329852490676802</guid><pubDate>Sun, 20 Mar 2011 17:29:00 +0000</pubDate><atom:updated>2011-03-20T22:59:40.445+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Style</category><category domain="http://www.blogger.com/atom/ns#">Databinding</category><category domain="http://www.blogger.com/atom/ns#">Debugging</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><title>Open source WPFInspector</title><description>&lt;p&gt;Another S&lt;a href="http://blois.us/Snoop/"&gt;noop&lt;/a&gt; like debugging tool for WPF.But this is useful to debug and inspect DataContext,Resources,Triggers &amp;amp; Styles.&lt;/p&gt;  &lt;p&gt;I don’t want to compare this with Snoop.Check it out yourself !!!&lt;/p&gt;  &lt;p&gt;&lt;a title="http://wpfinspector.codeplex.com" href="http://wpfinspector.codeplex.com"&gt;http://wpfinspector.codeplex.com&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-5836329852490676802?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TPu1WAm2_lUvL0BeR5IPRsxG7wQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TPu1WAm2_lUvL0BeR5IPRsxG7wQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TPu1WAm2_lUvL0BeR5IPRsxG7wQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TPu1WAm2_lUvL0BeR5IPRsxG7wQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/8js3AOMXh-E/open-source-wpfinspector.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2011/03/open-source-wpfinspector.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-2143448747793080369</guid><pubDate>Mon, 06 Dec 2010 05:17:00 +0000</pubDate><atom:updated>2010-12-06T10:47:22.649+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</category><category domain="http://www.blogger.com/atom/ns#">Application Architecture</category><title>Technology v/s Concepts and architecture</title><description>&lt;p&gt;First of all this is not a WPF technology post.I posted this in my WPF blog since it has some relation with WPF.ok let’s start.&lt;/p&gt;  &lt;p&gt;Technology here means the implementation languages or mediums for a programming solution such as &lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt;, Silverlight, Linq,WCF etc…While taking interviews, I have often heard that “I can learn or work in any technology since I know concepts and architecture”.Mostly this is the answer from a candidate when we ask “Do you know WPF or are you able to work in Silverlight?”. Some of my friends,they don’t even ready to rate themselves in the technology.If we ask them how do you rate yourself in WPF out of 10? they will say I am strong in concepts so I can do whatever work assigned to me in WPF.&lt;/p&gt;  &lt;p&gt;If we think from an entrepreneur perspective this cannot be accepted every time.A person cannot estimate the work in WPF without the knowledge in WPF whatever strong he is in programming concepts and architectures.Also if the work in WPF or Silverlight is critical companies cannot rely on the statement “I know concepts and architecture”.Lets take one example to prove this.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;The driver selection story&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You are working in Cochin and on a Friday your CEO decided to go Chennai to attend an important meeting on Saturday.There are no tickets in flights and trains since the trip is decided suddenly.So he decided to go by his new highly sophisticated BMW car.He needs some body with him to drive the whole 700 kilometers since he need to attend the meeting with freshness.&lt;/p&gt;  &lt;p&gt;There are 5 persons who are free in the week end and ready to accompany CEO.The first person, lets call him A said I have license but have no experience.Person B said I have license and have experience in riding motor cycle.Person C said I had driven my father’s truck.Person D said I have my own car which I am usually driving to come office.But its a 10 year old model.Person E said my uncle owns the same BMW model of yours and I usually drive it in the week ends and holidays.Who will accompany your CEO? obviously person E provided your CEO is smart :)&lt;/p&gt;  &lt;p&gt;The case of Person A can be compared like a network guy saying I can do WPF.Person B is like a assembly language programmer saying I can do the WPF without training since I know basics an experience in programming.The case C can be compared as a Java programmer applying for WPF job saying that I am strong in OOPS.The D is like a .Net 1.0 programmer saying I can do WPF since all are .Net.E is the real one who knows WPF.Persons A,B,C &amp;amp; D can do the job provided they get certain time to familiarize the new car and its features.But since the time is limited nobody can be considered for the position.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Do I need to give more importance on technology?&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The technology is getting importance over architecture depends on the situation or the demand.If we think from employer perspective ,he needs a technology guy if the work in particular technology is so critical and should be done in time.He don’t have time to give training to the guy he hires. If the requirement is for future project, the choice should give to the guys who are strong in concepts and architecture.Again that depends on the available time.If a WPF project is supposed to come on next month ,.Net guys can be hired and they can get training in WPF.If the time gap is 2 months JAVA or even assembly programming guys can also be included.&lt;/p&gt;  &lt;p&gt;Coming to the developer perspective ,he should find some time to the technology as well while learning the architecture.Also while learning technology, learn the technology by comparing with the previous one.Main important thing to consider is “why I should learn a new technology ?”.I know some of my friends doing WPF /Silverlight projects without using data binding.Also they are simply creating controls when and where needed without changing templates.I asked why are you using this technology ? They simply replied “My company/client wants this project to be done in WPF”.&lt;/p&gt;  &lt;p&gt;The moral of the story is “&lt;strong&gt;Learn technology before architecting your application and get benefits from it’s features&lt;/strong&gt;”.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-2143448747793080369?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gbg4Sf5j3BGn_HqZls-QO2iyNRw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gbg4Sf5j3BGn_HqZls-QO2iyNRw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gbg4Sf5j3BGn_HqZls-QO2iyNRw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gbg4Sf5j3BGn_HqZls-QO2iyNRw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/39zYZZZnMt0/technology-vs-concepts-and-architecture.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/12/technology-vs-concepts-and-architecture.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-3931533597525074683</guid><pubDate>Sun, 08 Aug 2010 16:41:00 +0000</pubDate><atom:updated>2010-08-08T22:12:19.844+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">XAML</category><category domain="http://www.blogger.com/atom/ns#">XAML 2009</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><category domain="http://www.blogger.com/atom/ns#">Common Code Base</category><title>Common Code Base 3 handling controls</title><description>&lt;p&gt;Another issue you are going to face is the namespace and assembly differences of classes in WPF and Silverlight.Especially you will find when dealing with controls.ie the classes will be there with same methods and properties.But in different namespaces or assemblies .That prevent us from having common code base.&lt;/p&gt;  &lt;p&gt;Lets just consider the case of TreeView in System.Windows.Controls namespace which is present in both WPF and Silverlight.In &lt;u&gt;WPF it is in the assembly PresentationFramework.dll but in Silverlight its System.Windows.Controls.dll&lt;/u&gt;. Ideally the schema mapping should do the correct mapping and we should be able to use the xaml. But unfortunately it is not mapped to the schema.Means if we use common xaml file for tree view it will show a compilation error in Silverlight.&lt;/p&gt; &lt;font color="#ff0000"&gt;The tag 'TreeView' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.&lt;/font&gt;   &lt;p&gt;Does this indicate we should stop common code? Not at all.We have one solution which uses inheritance as a hack.I didn’t even think, inheritance will have such a usage.Solution is as follows.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create your own class for TreeView by inheriting the framework TreeView.Have this linked to WPF too. &lt;/li&gt;    &lt;li&gt;Use your treeview throughout the application. &lt;/li&gt; &lt;/ol&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt; CCBTreeView&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Inherits&lt;/span&gt; System.Windows.Controls.TreeView&lt;br /&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Class&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;CCBTreeView would be in your controls project which refers PresentationFramework.dll and System.Windows.Controls.dll in WPF and Silverlight respectively. While using, use as follows. &lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;  &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UserControl&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;TestCompatibility.MyControl&amp;quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style="color: #ff0000"&gt;xmlns:CCBControls&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;clr-namespace:CCB.Controls;assembly=CCB.Controls&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CCBControls:CCBTreeView&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding Persons}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;UserControl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;This applies to so many controls such as HierarchicalDataTemplate,TabControl etc which differs in namespace or assembly.Refer the sample uploaded &lt;a href="http://cid-890c06c8106550a0.office.live.com/self.aspx/BlogSamples/JoyfulWPF/CCB%5E_Controls.zip"&gt;here&lt;/a&gt; if you still have confusion.Also let me know if anybody have better solution to this problem.&lt;br/&gt;&lt;br /&gt;&lt;strong&gt;Previous posts on Common Code Base&lt;/strong&gt;&lt;br /&gt;  &lt;br /&gt;---------------------------------------------- &lt;br /&gt;  &lt;br /&gt;&lt;a href="http://joyfulwpf.blogspot.com/2010/06/common-code-base-1-introduction.html"&gt;Common Code Base 1 Introduction&lt;/a&gt;&lt;br /&gt;  &lt;br /&gt;&lt;a href="http://joyfulwpf.blogspot.com/2010/07/common-code-base-2-styles-and-templates.html"&gt;Common Code Base 2 Styles and Templates&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-3931533597525074683?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zdC5el4cXDpojNecNq4X3v_ReVE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zdC5el4cXDpojNecNq4X3v_ReVE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zdC5el4cXDpojNecNq4X3v_ReVE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zdC5el4cXDpojNecNq4X3v_ReVE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/BHbyd6fVSxU/common-code-base-3-handling-controls.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/08/common-code-base-3-handling-controls.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-3543893254066601889</guid><pubDate>Sat, 07 Aug 2010 11:37:00 +0000</pubDate><atom:updated>2010-08-07T17:07:30.721+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><category domain="http://www.blogger.com/atom/ns#">Databinding</category><category domain="http://www.blogger.com/atom/ns#">XAML 2009</category><title>Debugging WPF and Silverlight DataBinding</title><description>&lt;p&gt;Good article about debugging data binding in WPF and silverlight.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx" href="http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx"&gt;http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In short we can debug databinding in 2 ways   &lt;br /&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Looking at the output/immediate window. &lt;/li&gt;    &lt;li&gt;Using converters. &lt;/li&gt;    &lt;li&gt;Putting break points in get and set regions of properties &lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-3543893254066601889?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CrueB0PE2chGBp24BbCKOwbUwo8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CrueB0PE2chGBp24BbCKOwbUwo8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CrueB0PE2chGBp24BbCKOwbUwo8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CrueB0PE2chGBp24BbCKOwbUwo8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/ixpP4GYlj4M/debugging-wpf-and-silverlight.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/08/debugging-wpf-and-silverlight.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-532149835779984472</guid><pubDate>Sat, 03 Jul 2010 18:50:00 +0000</pubDate><atom:updated>2010-07-04T00:22:43.281+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Template</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><category domain="http://www.blogger.com/atom/ns#">Style</category><category domain="http://www.blogger.com/atom/ns#">Common Code Base</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><title>Common Code Base 2 Styles and Templates</title><description>&lt;p&gt;As everybody knows Silverlight doesn’t support the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.trigger.aspx"&gt;Triggers&lt;/a&gt; which are most common in WPF.That means we cannot use WPF styles as it is.So obviously we need to create new styles even for Silverlight 4 which are same in behavior but using different xaml.Below are the best practices which we can follow to tackle the styles and templates in Common Code Base&amp;#160; scenario.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Don’t write any inline styles.Use resource dictionaries. &lt;/li&gt;    &lt;li&gt;Merge the resource dictionaries at the application level only. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This will solve the issue with basic styles.Think of a scenario where you are loading the styles dynamically.In WPF you can handle this using DynamicResource binding extension.But the sad thing is Silverlight doesn’t support DynamicResource. So what is the solution.    &lt;br /&gt;The solution which we applied was very easy.Use StaticResource in the XAML files and load the styles through code in the App.xaml.vb file.Yes it worked in WPF too.     &lt;br /&gt;Download sample from &lt;a href="http://cid-890c06c8106550a0.office.live.com/self.aspx/BlogSamples/JoyfulWPF/CCB%5E_Test%5E_Styles.zip"&gt;here&lt;/a&gt; to see the styles and templates in action in CCB.(See the foreground of Button.Its coming through Style)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Previous posts on Common Code Base&lt;/strong&gt;     &lt;br /&gt;----------------------------------     &lt;br /&gt;&lt;a href="http://joyfulwpf.blogspot.com/2010/06/common-code-base-1-introduction.html"&gt;Common Code Base 1 Introduction&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-532149835779984472?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tsHCgVASfcKbLx5dIYuKwNwn31g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tsHCgVASfcKbLx5dIYuKwNwn31g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tsHCgVASfcKbLx5dIYuKwNwn31g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tsHCgVASfcKbLx5dIYuKwNwn31g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/hE1BmVJA_CU/common-code-base-2-styles-and-templates.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/07/common-code-base-2-styles-and-templates.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-1560943874215652877</guid><pubDate>Thu, 17 Jun 2010 07:37:00 +0000</pubDate><atom:updated>2010-06-17T13:07:00.439+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">WCF</category><title>Calling WCF service without AddReference</title><description>&lt;p&gt;One of my &lt;a href="http://silverlightedweb.blogspot.com/"&gt;Silverlight blog&lt;/a&gt; post is about &lt;a href="http://silverlightedweb.blogspot.com/2010/03/creating-wcf-proxy-without-reference.html"&gt;creating a proxy without using the add reference&lt;/a&gt; menu in the Visual studio.The solution there is to write all the code which is auto generated when we add the reference through the proxy.ie we are just avoiding the auto generation and writing ourselves.Not a good solution.The reason we need to write all is because Silverlight supports only the Async service calls.But if we consider WPF we can call the service in Sync way.That means we can try out new things which will reduce our works in creating the manual proxy.&lt;/p&gt; &lt;p&gt;Didn’t get anything? In short we are going to create a proxy and call service without using the Add Service Reference menu or the any of the tool (eg:&lt;a href="http://msdn.microsoft.com/en-us/library/aa347733.aspx"&gt;svcutil&lt;/a&gt;)available for generating the proxy.How can we achieve that.It’s simple .&lt;strong&gt;Share the contract dll&lt;/strong&gt;.Important thing here is the sharing of contract dll is possible only because WPF and the WCF is using the same framework and runtime.This will not be possible in case of Silverlight since the runtime is different.&lt;/p&gt; &lt;p&gt;Ok.Lets start.We need 3 projects mainly.One is the Contracts where we keep all the WCF contracts.Then a service host project and a consumer of services.In the attached sample the host is a web host and the consumer is a WPF application.We can also host the WCF service in ConsoleHost.But in that case we need to solutions.Thats why I decided to go with WebHost.Below is solution structure.&lt;img src="http://lh3.ggpht.com/_jIJDXxbTxiU/TBR_s0U_umI/AAAAAAAAAME/QczaUB4h8yY/s512/ManualProxy.jpg" /&gt; &lt;/p&gt; &lt;p&gt;Note that there is no ServiceReference in the WPF UI project.Only thing is the reference to Core project which contains all the contracts.App.Config should be same as of normal proxy creation in case you want to use default connection settings.All the magic happens inside the ServiceProxy class which is inheriting the &lt;a href="http://msdn.microsoft.com/en-us/library/ms576141.aspx"&gt;ClientBase&lt;/a&gt; with a generic class.It will be clear after seeing the code below.&lt;/p&gt; &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Imports&lt;/span&gt; System.ServiceModel&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Imports&lt;/span&gt; ManualProxyTest.Core&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt; ServiceProxy&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Inherits&lt;/span&gt; ClientBase(Of IMyService)&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Implements&lt;/span&gt; IMyService&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt; GetData(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; value &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Implements&lt;/span&gt; IMyService.GetData&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Channel.GetData(value)&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt; Divide(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; no1 &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; no2 &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Double&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Implements&lt;/span&gt; IMyService.Divide&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Channel.Divide(no1, no2)&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt; GetChar(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; data &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; position &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Char&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Implements&lt;/span&gt; IMyService.GetChar&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Channel.GetChar(data, position)&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Function&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Class&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;For calling the service just create the instance of ServiceProxy and call as usual.Main advantage is the cleanliness in the code and we will have full control over the code.&lt;a href="http://cid-890c06c8106550a0.office.live.com/self.aspx/BlogSamples/JoyfulWPF/ManualProxy.zip"&gt;Sample can be downloaded from here&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-1560943874215652877?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tbb3VAqwyfkEI0EyEuGJtzKNs9E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tbb3VAqwyfkEI0EyEuGJtzKNs9E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tbb3VAqwyfkEI0EyEuGJtzKNs9E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tbb3VAqwyfkEI0EyEuGJtzKNs9E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/iW99JP8txx0/calling-wcf-service-without.html</link><author>noreply@blogger.com (Joy George)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_jIJDXxbTxiU/TBR_s0U_umI/AAAAAAAAAME/QczaUB4h8yY/s72-c/ManualProxy.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/06/calling-wcf-service-without.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-5735265784062193620</guid><pubDate>Sat, 12 Jun 2010 09:46:00 +0000</pubDate><atom:updated>2010-06-12T15:16:47.193+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Common Code Base</category><title>Common Code Base 1 Introduction</title><description>&lt;p&gt;The thoughts on common code base or single code base for both desktop applications and internet applications has been started with introduction of C# in Silverlight 2. That brought not only the same design and coding languages into WPF and Silverlight but also the same APIs.&lt;/p&gt;  &lt;p&gt;Same coding language was used earlier too.It was for Windows forms and ASP.Net.Even we were able to share the assemblies among them.But we were not able to create same application layer for them since the APIs and the design mediums were different.As time evolves Microsoft introduced the concept of XAML and made almost all the APIs same.&lt;/p&gt;  &lt;p&gt;As everybody knows still Silverlight is the subset of WPF even in its 4th version.There are so many classes and members missing in Silverlight if we compare with the WPF equivalent.Does that means we cannot go for the common code base?&lt;/p&gt;  &lt;p&gt;No.We can go for the approach of common code base as of now.But you cannot have certain WPF specific features in your application.Do your client allows that ? absolutely not.So we need to tackle that situation by providing WPF specific features in the desktop release.That means the road to the single code base is not that much easy as you think. So what is the simpe solution?&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The solution is very easy.Develop your application against Silverlight excluding Silverlight specific features such as DeepZoom and compile the same code for WPF&lt;/strong&gt;.It should work.I am saying this should work because most of the Silverlight classes and their members are available in WPF as same.&lt;/p&gt;  &lt;p&gt;This will work if you are developing a simple application without WPF specific features.If you want to use WPF specific features you need to architect your application in such a way that it is following MVVm strictly.MVVm will allow you to switch the views very easily without changing the underlying layers.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Solution structure.&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Develop against Silverlight then it will work in WPF. We need to remember this thing while creating the visual studio solution structure.So first create the Silverlight projects and keep the code and xaml files there.Then create WPF projects and link the files from Silverlight project location.Easy..What ever feature you implement in Silverlight or the fixes you do will reflect in WPF application too.&lt;img src="http://lh5.ggpht.com/_jIJDXxbTxiU/TBNW27li_7I/AAAAAAAAAMA/N8CzyuF3eqI/s512/CCB_1_1.jpg" /&gt; &lt;/p&gt;  &lt;p&gt;Look at the files MyControl.xaml and MyViewModel.They are real files in the Online solution and linked in Desktop project.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Issues&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;First issue you may encounter is XAML incompatibility.In WPF when we create a xaml style you normally specify as x:Type Classname.But this x:Type is not at all supported in Silverlight. Silverlight needs just the class name without x:Type .If you look at some of the controls like TreeView ,In WPF this resides in the PresentationFramework dll but in Silverlight it is in System.Windows.Controls.dll so we cannot have same xaml shared between WPF and Silverlight projects.There are so many issues like this.Will discuss about one by one in subsequent posts to make the real common code base.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-5735265784062193620?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uuf_oPQbAhJBp8mZzfBMPOnnpf0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uuf_oPQbAhJBp8mZzfBMPOnnpf0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/uuf_oPQbAhJBp8mZzfBMPOnnpf0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uuf_oPQbAhJBp8mZzfBMPOnnpf0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/twWk6uJHJok/common-code-base-1-introduction.html</link><author>noreply@blogger.com (Joy George)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_jIJDXxbTxiU/TBNW27li_7I/AAAAAAAAAMA/N8CzyuF3eqI/s72-c/CCB_1_1.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/06/common-code-base-1-introduction.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-3829234194011491457</guid><pubDate>Sun, 06 Jun 2010 10:41:00 +0000</pubDate><atom:updated>2010-06-06T16:13:47.915+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Bug</category><category domain="http://www.blogger.com/atom/ns#">DataTemplate</category><category domain="http://www.blogger.com/atom/ns#">.Net 3.5</category><title>WPF 3.5 Bug in inheriting DataTemplate</title><description>&lt;p&gt;You can easily reproduce the bug.Just inherit the DataTemplate and use the new DataTemplate class instead of default.You will get an runtime exception.&lt;/p&gt;  &lt;p&gt;Your DataTemplate class&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyDataTemplate :DataTemplate&lt;br /&gt;{&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Nothing unusual rite? Then use this DataTemplate in your XAML.&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;  &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;lstPersons&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;local:MyDataTemplate&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Button&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding Name}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;local:MyDataTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Just using the new class.But when we run this we get the exception as follows.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;StackPanel' object cannot be added to 'MyDataTemplate'. Object of type 'System.Windows.Controls.StackPanel' cannot be converted to type 'System.Windows.FrameworkElementFactory.&lt;br/&gt;&lt;br /&gt;This is true same in the case of HierarchicalDataTemplate too.&lt;br/&gt;&lt;br /&gt;This is an identified bug.Microsoft has fixed this and WPF 4 contains the fix.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-3829234194011491457?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wQfsUU-dK2hQTHrOsmwJ71V3mi8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wQfsUU-dK2hQTHrOsmwJ71V3mi8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wQfsUU-dK2hQTHrOsmwJ71V3mi8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wQfsUU-dK2hQTHrOsmwJ71V3mi8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/jVr5aQl8oAk/wpf-35-bug-in-inheriting-datatemplate.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/06/wpf-35-bug-in-inheriting-datatemplate.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-8487368840613824252</guid><pubDate>Fri, 09 Apr 2010 13:34:00 +0000</pubDate><atom:updated>2010-04-09T19:04:00.585+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><title>Getting ListBoxItem from selected entity</title><description>&lt;p&gt;There will be some scenarios where we need to get the object of ListBoxItem which is hosting one of the the bound entity.Most probably it may be the SelectedItem.&lt;/p&gt;  &lt;p&gt;Consider this scenario there is an business class called Employee and it’s collection class is EmployeeCollection.We have binding which binds object of EmployeeCollection to a ListBox.If we access the SelectedItem property of ListBox it will return the Employee object.But the requirement is to get the ListBoxItem which hosts the selected entity on an event say SelectionChanged.&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; lbi &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; ListBoxItem = lstBox.ItemContainerGenerator.ContainerFromItem(lstBox.SelectedItem)&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The above code can be used to get ListBoxItem of any object which is present in the collection.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-8487368840613824252?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/P3c7-5Qm8jNHKy6qtyztkQog8XU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/P3c7-5Qm8jNHKy6qtyztkQog8XU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/P3c7-5Qm8jNHKy6qtyztkQog8XU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/P3c7-5Qm8jNHKy6qtyztkQog8XU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/NyzEd2w2AZ0/getting-listboxitem-from-selected.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/04/getting-listboxitem-from-selected.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-583089408200273886</guid><pubDate>Wed, 07 Apr 2010 13:31:00 +0000</pubDate><atom:updated>2010-04-07T19:01:04.222+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><title>Why WPF ProgressBar is not updating</title><description>&lt;p&gt;When you put a loop and try to update the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.progressbar.aspx"&gt;ProgressBar&lt;/a&gt; from that loop, it will not update the visual.The visual will update only after the execution of the loop.ie you can’t see the incremental animation.Here is the solution for that issue.&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; btn_Click(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.&lt;span style="color: #0000ff"&gt;Object&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; e &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Windows.RoutedEventArgs)&lt;br /&gt;    IncrementContinuously()&lt;br /&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; IncrementContinuously()&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;For&lt;/span&gt; i = 0 &lt;span style="color: #0000ff"&gt;To&lt;/span&gt; 50&lt;br /&gt;        Thread.Sleep(100)&lt;br /&gt;        prgs.Dispatcher.Invoke(&lt;span style="color: #0000ff"&gt;New&lt;/span&gt; CrossAppDomainDelegate(&lt;span style="color: #0000ff"&gt;AddressOf&lt;/span&gt; IncrementBy1), DispatcherPriority.Background, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;)&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;Next&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Sub&lt;/span&gt; IncrementBy1()&lt;br /&gt;    prgs.Value = prgs.Value + 1&lt;br /&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This &lt;a href="http://stackoverflow.com/questions/1194620/c-newbie-show-progress-during-a-loop-wpf"&gt;link&lt;/a&gt; contains some more solutions.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-583089408200273886?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/l220qcSh0s5_ljeTbUU0MDZkf9M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l220qcSh0s5_ljeTbUU0MDZkf9M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/l220qcSh0s5_ljeTbUU0MDZkf9M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l220qcSh0s5_ljeTbUU0MDZkf9M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/sDJnvpp-Qk8/why-wpf-progressbar-is-not-updating.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/04/why-wpf-progressbar-is-not-updating.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-6879210313557177180</guid><pubDate>Tue, 09 Mar 2010 14:24:00 +0000</pubDate><atom:updated>2010-03-09T19:54:54.940+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">MCTS</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</category><title>MCTS in WPF</title><description>&lt;p&gt;It was my great ambition to clear WPF exam and became a MCTS from the day I started developing in WPF.Yesterday I achieved that.After getting the certification I was just thinking what are the benefits of taking such a certification? Even one of my colleague asked me what you are going to earn by writing these exams? Is it just because company is paying me the fees?&lt;/p&gt;  &lt;p&gt;Absolutely no.There are some benefits as a developer.One is “We will get full coverage of WPF”.Second we gets some sort of “recognition in the community” .Third ,we can have the MCTS logo in our resume.The last benefit is our certification will help our company to get or retain partnership with Microsoft.&lt;/p&gt;  &lt;p&gt;I don’t care about the last 3 points .Normally people does certification for that.If you elaborate the first point we can see the real benefit of certification.The coverage I meant is about the different areas in WPF.The certification includes all most all areas of WPF including 3D. Even if a person is working in WPF from the beginning, the chance for him to work in 3D is very less.That means he may know anything about 3D programming which is a great feature in WPF.By going for certification he needs to have a little knowledge about 3D programming in WPF using ViewPort3D,Camera etc…&lt;/p&gt;  &lt;p&gt;Even I learnt different usages of documents only because of the preparation for the MCTS Exam.So try to get certified in the technology and move smoothly in the fast moving tech world.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-6879210313557177180?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6jstbKDD30lWBiztSd5ZACPcnKw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6jstbKDD30lWBiztSd5ZACPcnKw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6jstbKDD30lWBiztSd5ZACPcnKw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6jstbKDD30lWBiztSd5ZACPcnKw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/cQaVt82NdJ8/mcts-in-wpf.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>3</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/03/mcts-in-wpf.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-5663231309778120163</guid><pubDate>Mon, 01 Feb 2010 13:35:00 +0000</pubDate><atom:updated>2010-02-01T19:05:18.615+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">MVVM</category><category domain="http://www.blogger.com/atom/ns#">INotifyPropertyChanged</category><category domain="http://www.blogger.com/atom/ns#">Lambda Expressions</category><title>Type safe INotifyPropertyChanged</title><description>&lt;p&gt;Usually we pass the property name as string from the setter of properties and raise the INotifyPropertyChanged.PropertyChanged event.This is not type safe as you.There are chances that the end developers may misspell the property name.The below link gives a great idea to make your OnPropertyChanged calls type safe.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://mfelicio.wordpress.com/2010/01/10/safe-usage-of-inotifypropertychanged-in-mvvm-scenarios/" href="http://mfelicio.wordpress.com/2010/01/10/safe-usage-of-inotifypropertychanged-in-mvvm-scenarios/"&gt;http://mfelicio.wordpress.com/2010/01/10/safe-usage-of-inotifypropertychanged-in-mvvm-scenarios/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-5663231309778120163?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/VMD_BCdRFe7xjAG0aICWTSGneA0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VMD_BCdRFe7xjAG0aICWTSGneA0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/VMD_BCdRFe7xjAG0aICWTSGneA0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/VMD_BCdRFe7xjAG0aICWTSGneA0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/YkfGMaNv-dg/type-safe-inotifypropertychanged.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2010/02/type-safe-inotifypropertychanged.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-877022948130111304</guid><pubDate>Tue, 08 Dec 2009 14:00:00 +0000</pubDate><atom:updated>2009-12-08T19:30:36.561+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.Net 4</category><category domain="http://www.blogger.com/atom/ns#">XAML 2009</category><title>New WPF and XAML features</title><description>&lt;p&gt;For those who didn’t try the new features yet.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/llobo/archive/2009/11/25/concluding-new-wpf-features-series.aspx"&gt;http://blogs.msdn.com/llobo/archive/2009/11/25/concluding-new-wpf-features-series.aspx&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/llobo/archive/2009/11/19/xaml-2009-features-generics-support.aspx"&gt;http://blogs.msdn.com/llobo/archive/2009/11/19/xaml-2009-features-generics-support.aspx&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-877022948130111304?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cMSQv0AGRsYA97OZTc_O_RDuF7E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cMSQv0AGRsYA97OZTc_O_RDuF7E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cMSQv0AGRsYA97OZTc_O_RDuF7E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cMSQv0AGRsYA97OZTc_O_RDuF7E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/JI5uBTA2o88/new-wpf-and-xaml-features.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/12/new-wpf-and-xaml-features.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-6149961038292547141</guid><pubDate>Thu, 01 Oct 2009 16:12:00 +0000</pubDate><atom:updated>2009-10-01T21:42:00.122+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Markup extension</category><category domain="http://www.blogger.com/atom/ns#">Lambda Expressions</category><title>Using Lambda expression in XAML databinding</title><description>&lt;p&gt;When I was in net last week end the below links took my attention.The reason was they explain how can we give lambda expressions in XAML.As a developer you might also wonder how the author did that.&lt;br&gt;It is by creating a custom markup extension and constructing lambda expressions on the fly.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://www.fikrimvar.net/lestirelim/?p=15"&gt;WPFix Part 1&lt;/a&gt;  &lt;li&gt;&lt;a href="http://www.fikrimvar.net/lestirelim/?p=18"&gt;WPFix Part 2 (Binding Extension)&lt;/a&gt;  &lt;li&gt;&lt;a href="http://www.fikrimvar.net/lestirelim/?p=23"&gt;WPFix Part 3 (Extension Methods)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Thanks to &lt;a href="http://www.fikrimvar.net/lestirelim/"&gt;M. Orçun Topdağı&lt;/a&gt; for such a smart solution.I need to find out another way to implement this in my current project as that is in Silverlight and Silverlight does't support custom mark-up extensions.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-6149961038292547141?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/BvnTw_0lCB4CpNNp4PPoJ6FmVas/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BvnTw_0lCB4CpNNp4PPoJ6FmVas/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/BvnTw_0lCB4CpNNp4PPoJ6FmVas/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/BvnTw_0lCB4CpNNp4PPoJ6FmVas/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/HdE5oLXiWjU/using-lambda-expression-in-xaml.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/10/using-lambda-expression-in-xaml.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-1003265128026770522</guid><pubDate>Wed, 23 Sep 2009 12:02:00 +0000</pubDate><atom:updated>2009-09-23T17:32:00.426+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">XAML</category><title>Auto formatting XAML code</title><description>&lt;p&gt;Here is one way to format our XAML code in a neat way.In VisualStudio open the Options dialog. Tools-&amp;gt;Options.&lt;/p&gt; &lt;p&gt;Goto TextEditor-&amp;gt;XAML-&amp;gt;Formatting-&amp;gt;Spacing and set the options as per the below image.&lt;/p&gt; &lt;p&gt;&lt;img src="http://lh6.ggpht.com/_aj33GswKSsg/SrTHcvNXOWI/AAAAAAAAMbk/NsMpviTqzE8/xamlformatting.PNG" width="640" height="371"&gt; &lt;/p&gt;Set it as XAML coding practice and do a smooth code review...  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-1003265128026770522?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IjxwjxSSQnC61d3BhIvbB4SNJEU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IjxwjxSSQnC61d3BhIvbB4SNJEU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IjxwjxSSQnC61d3BhIvbB4SNJEU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IjxwjxSSQnC61d3BhIvbB4SNJEU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/-BSqZIPjMlc/auto-formatting-xaml-code.html</link><author>noreply@blogger.com (Joy George)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_aj33GswKSsg/SrTHcvNXOWI/AAAAAAAAMbk/NsMpviTqzE8/s72-c/xamlformatting.PNG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/09/auto-formatting-xaml-code.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-6875815460942929073</guid><pubDate>Sat, 19 Sep 2009 11:22:00 +0000</pubDate><atom:updated>2009-09-19T17:04:19.928+05:30</atom:updated><title>Understanding WPF ResourceDictionary</title><description>&lt;p align="justify"&gt;When I did a WPF training to .net 2.0 audience, it took some more time to explain the concept of Resource dictionaries.The were all familiar to the resource concept in .net and were trying to relate this to the resource files.&lt;br&gt;&lt;strong&gt;&lt;u&gt;What is ResourceDictionary in WPF&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;WPF resource dictionary is just a collection of objects which are accessible by their corresponding key.&lt;/p&gt;&lt;/blockquote&gt; &lt;p align="justify"&gt;The objects here means anything which are derived from System.Object.Including integers, strings and controls like TextBlock and Buttons.&amp;nbsp; Normally people thinks that ResourceDictionary is something which is related to Window, Styles &amp;amp; Templates.The problem is that we normally use ResourceDictionary along with Styles and Templates.See a simple sample below.&lt;/p&gt; &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt; &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Window1"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns:sys&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="clr-namespace:System;assembly=mscorlib"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Window1"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:Byte&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="day"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;18&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:Byte&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:String&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="month"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Apr&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:String&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:Int32&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="year"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;1984&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:Int32&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="monthtxt"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource month}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:Double&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="fontsize"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;14&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:Double&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Orientation&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Horizontal"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;FontSize&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource fontsize}"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="My DOB :"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ContentControl&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource day}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ContentControl&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource monthtxt}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ContentControl&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource year}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;Note that the integer and string are from mscorlib. &lt;br /&gt;&lt;p align="justify"&gt;&lt;strong&gt;&lt;u&gt;Who all can have ResourceDictionary&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;In simple words who has a property of type ResourceDictionary can hold resources. Here the Resources property defined in one of the base classes called &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.aspx"&gt;FrameworkElement&lt;/a&gt;. Most of the WPF elements are inherited from FrameworkElement and hence they can hold resources.&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Accessing objects in ResourceDictionary&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;There are mainly 2 ways to get objects from ResourceDictionary.One is through XAML with &lt;a href="http://msdn.microsoft.com/en-us/library/ms747254.aspx"&gt;mark-up extension&lt;/a&gt; and other through code.The above code shows how to retrieve through the &lt;a href="http://msdn.microsoft.com/en-us/library/ms750950.aspx"&gt;StaticResource&lt;/a&gt; markup extension.Another method is through the tag &amp;lt;StaticResource&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Window1"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns:sys&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="clr-namespace:System;assembly=mscorlib"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:String&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="fullname"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Joy George K&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sys:String&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Key&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="nametxt"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource fullname}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Orientation&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Horizontal"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="FullName :"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;StaticResource&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ResourceKey&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="nametxt"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;u&gt;Accessing from Code&lt;/u&gt;&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; fullname &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt; = &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.FindResource(&lt;span style="color: #006080"&gt;"fullname"&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;If&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Not&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;.IsNullOrEmpty(fullname) &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    MessageBox.Show(&lt;span style="color: #006080"&gt;"My FullName :"&lt;/span&gt; &amp;amp; fullname)&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; If&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;My current project is in VB.Net and that is why you are seeing vb code instead of C# :-)&lt;br/&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Merged ResourceDictionaries&lt;/u&gt;&lt;/strong&gt;&lt;br/&gt;&lt;br /&gt;Now one question comes.I have so many resources in ResourceDictionary such as Brushes, ControlTemplates and Styles.Can I categorize these in to separate files and merge them like CSS ? &lt;br/&gt;&lt;br /&gt;Yes.It is possible by using &lt;a href="http://msdn.microsoft.com/en-us/library/aa350178.aspx"&gt;Merged ResourceDictionaries&lt;/a&gt;.Add ResourceDictionary files by following the steps below and merge them at your Window or Application level.&lt;br/&gt;&lt;br /&gt;Right click on the project -&amp;gt; Add -&amp;gt; ResourceDictionary&lt;img src="http://lh3.ggpht.com/_aj33GswKSsg/SrSsg62r3OI/AAAAAAAAMbg/8KMvRQfnhIY/AddResourceDictionary.png"&gt; &lt;/p&gt;&lt;br /&gt;The below code show how to merge the ResourceDictionaries into your Window.xaml&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Window1"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #ff0000"&gt;xmlns:sys&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="clr-namespace:System;assembly=mscorlib"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ResourceDictionary&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Source&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="brushes.xaml"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ResourceDictionary&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Orientation&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Horizontal"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="FullName : Joy George K"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                   &lt;span style="color: #ff0000"&gt;Background&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{StaticResource background}"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;StackPanel&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Window&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align="justify"&gt;&amp;nbsp;&lt;u&gt;&lt;strong&gt;Static &amp;amp; Dynamic ResourceDictionaries&lt;/strong&gt;&lt;/u&gt;&lt;br&gt;We have seen the resources are being accessed by a mark-up extension StaticResource. Normally one question comes into our mind as a developer.&lt;em&gt;Is there something called DynamicResource?&lt;/em&gt;&lt;br&gt;Yes.There exists DynamicResource mark-up extension too.Then what are the differences?&lt;br&gt;&lt;em&gt;The main difference between Static and Dynamic resource mark-up extensions is the value calculation.In StaticResource it is done only once.But in DynamicResource it is done when ever the value of the resource changes.&lt;/em&gt;&lt;br&gt;I know it is difficult to understand.First question will be how to change the value of resource ? Simple .Its by code.&lt;br&gt;Lets take one example.There is a Brush resource in ResourceDictionary with color white and key backBrush.We have used this brush to give background to 2 StackPanels.One is by StaticResource and another is by DynamicResource mark-up extension.&lt;br&gt;It will work fine.When we run the application both these StackPanels will have white as background.Now suppose if I change the value of backBrush resource to Red through code what will happen? The answer is .The StackPanel which used DynamicResource will get the Red color and the other will be still in white.Hope this clears.&lt;/p&gt;&lt;br /&gt;&lt;p align="justify"&gt;Refer this &lt;a href="http://cid-890c06c8106550a0.skydrive.live.com/self.aspx/BlogSamples/JoyfulWPF/ResourceDictionary.zip"&gt;sample&lt;/a&gt; if you are still in confusion.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-6875815460942929073?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rs8FSmUDUsTR9P5ju3Ze4xAPrBQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rs8FSmUDUsTR9P5ju3Ze4xAPrBQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rs8FSmUDUsTR9P5ju3Ze4xAPrBQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rs8FSmUDUsTR9P5ju3Ze4xAPrBQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/0agxLDdpW8Q/understanding-wpf-resourcedictionary.html</link><author>noreply@blogger.com (Joy George)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_aj33GswKSsg/SrSsg62r3OI/AAAAAAAAMbg/8KMvRQfnhIY/s72-c/AddResourceDictionary.png" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/09/understanding-wpf-resourcedictionary.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-4737210679533991178</guid><pubDate>Fri, 31 Jul 2009 19:01:00 +0000</pubDate><atom:updated>2009-08-01T00:31:58.542+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</category><title>WPF Training at Orion</title><description>I have seen so many times &lt;a href="http://jimmangaly.blogspot.com/"&gt;Jim Mangaly&lt;/a&gt; giving nice presentations and trainings, when I was working in &lt;a href="http://www.identitymine.com/"&gt;Identitymine&lt;/a&gt;.As a Software engg I never thought that I have to take WPF sessions.&lt;br /&gt;
&lt;br /&gt;
But the earth didn't stop it's rotations.It became weeks,weeks became months and months became years.After 2 years I joined in &lt;a href="http://www.orioninc.com/"&gt;Orion Inc&lt;/a&gt; and at a fine noon ,I&amp;nbsp;was asked to&amp;nbsp;present a WPF&amp;nbsp;session.&lt;br /&gt;
&lt;br /&gt;
Initially I was in big confusion "How to present the new features in WPF ?" It is very easy to work with.But very difficult to make others understand&amp;nbsp;these new features.I had 1 hour left with me to prepare.It is not enough to prepare even about XAML.But I have to convey what is xaml.My audience&amp;nbsp;is from .Net2.0 so finally I decided to present WPF features by relating the drawbacks&amp;nbsp;of .Net 2.0 windows forms, and&amp;nbsp;coresponding solutions in WPF.See&amp;nbsp;some examples below.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Windows forms developer has to get design(in some format like jpg) from designer and implement himself.This eats a good amount developer's precious time and the work is repetition.WPF has a solution which is called XAML to solve this problem.&lt;/li&gt;
&lt;li&gt;In Windows forms if&amp;nbsp;someone needs to replace a digital clock control by analog clock he has to create a new control and override it's &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint.aspx"&gt;OnPaint&lt;/a&gt; method.But WPF provides a mechanism called templating which does this in a shorter time.&lt;/li&gt;
&lt;li&gt;Rotating a button in Windows forms is a 'Job'.But in WPF its a matter of 3 lines of code which specifies a RotateTransform.&lt;/li&gt;
&lt;/ul&gt;Yes.This did the trick.At least they got some words like "XAML","Template","Transform","Styles" etc...&amp;nbsp;which are going to make their life easier in the WPF world.The feedback was good and I decided to continue giving detailed sessions on WPF.2 sessions are over as of now and hope I can complete the other sessions soon...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-4737210679533991178?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6gpFu0tl7MlWOKeYL8k0LBbzN8o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6gpFu0tl7MlWOKeYL8k0LBbzN8o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6gpFu0tl7MlWOKeYL8k0LBbzN8o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6gpFu0tl7MlWOKeYL8k0LBbzN8o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/ICd8a5c2oVk/wpf-training-at-orion.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/08/wpf-training-at-orion.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-73206347007730149</guid><pubDate>Sun, 12 Jul 2009 17:55:00 +0000</pubDate><atom:updated>2009-07-12T23:25:02.696+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Style</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><title>Different styles for alternate rows in ListBox</title><description>&lt;p&gt;Simple but important feature which really help us in real-time applications.Giving different look and feel or colors to alternate rows helps users to differentiate two consecutive rows in a ListBox or ListView.Basically controls which are derived from &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.aspx"&gt;ItemsControl&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Below xaml code shows how alternate colors are applied into a ListBox&lt;/p&gt; &lt;p&gt;Xaml code to create ListBox with 6 items&lt;/p&gt; &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt; &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;AlternationCount&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="2"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item1"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item2"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item3"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item4"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item5"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item6"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Xaml code of the Style which has the alternate style support.Note the change is in the ItemContainerStyle.Here Style is applied to ListBoxItem&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;TargetType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{x:Type ListBoxItem}"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="ItemsControl.AlternationIndex"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                 &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="0"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Background"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="LightBlue"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="ItemsControl.AlternationIndex"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                 &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="1"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Background"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="LightGreen"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;When we run it shows as follows&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;img src="http://lh4.ggpht.com/_aj33GswKSsg/SlogXXn0ahI/AAAAAAAAMZ4/tBav-uZ3auM/Alternation2.PNG"&gt; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Description&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Here the ItemsControl has got most of the implementation part.It has some members which control the behavior of alternate style.The attached property &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.alternationindex.aspx"&gt;ItemsControl.AlternationIndex&lt;/a&gt; tells the index and according to that we can change color or anything through style.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The Alternation count specifies the frequency.Below code uses 3 as &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.alternationcount.aspx"&gt;ItemsControl.AlternationCount&lt;/a&gt;.See the difference.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Creating ListBox&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;AlternationCount&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="3"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item1"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item2"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item3"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item4"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item5"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBoxItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Content&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Item6"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ListBox&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Style supports AlternationCount=3&lt;/p&gt;&lt;br /&gt;&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;&lt;br /&gt;&lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt;  &lt;span style="color: #ff0000"&gt;TargetType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="{x:Type ListBoxItem}"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="ItemsControl.AlternationIndex"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                 &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="0"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Background"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="LightBlue"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="ItemsControl.AlternationIndex"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                 &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="1"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Background"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="LightGreen"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="ItemsControl.AlternationIndex"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                 &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="2"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Background"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="LightYellow"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Trigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;img src="http://lh3.ggpht.com/_aj33GswKSsg/SlogXQbPhzI/AAAAAAAAMZ8/aar8kIlBGgY/Alternation3.PNG"&gt; &lt;/p&gt;&lt;br /&gt;&lt;p&gt;I don't think a sample is needed.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-73206347007730149?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8ua6Ukydkw62X68LJOCL7Eb7Yqs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ua6Ukydkw62X68LJOCL7Eb7Yqs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8ua6Ukydkw62X68LJOCL7Eb7Yqs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ua6Ukydkw62X68LJOCL7Eb7Yqs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/mOXGP-Yr7xo/different-styles-for-alternate-rows-in.html</link><author>noreply@blogger.com (Joy George)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_aj33GswKSsg/SlogXXn0ahI/AAAAAAAAMZ4/tBav-uZ3auM/s72-c/Alternation2.PNG" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/07/different-styles-for-alternate-rows-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-8567905734871594438</guid><pubDate>Tue, 09 Jun 2009 10:28:00 +0000</pubDate><atom:updated>2009-06-09T15:58:00.634+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Surface Development</category><category domain="http://www.blogger.com/atom/ns#">Surface</category><category domain="http://www.blogger.com/atom/ns#">Microsoft Surface</category><title>Deploying applications in Microsoft Surface SP1</title><description>&lt;p align="justify"&gt;The surface has a launcher application which is launching applications registered with the Surface Shell.Launcher can be activated from any of the 4 access points located at corners of surface.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Registering Microsoft Surface Application&lt;/u&gt;&lt;/strong&gt;     &lt;br /&gt;To register an application with Microsoft surface shell we have to copy the application’s xml definitions file into the &lt;strong&gt;%PROGRAMDATA%\Microsoft\Surface\Programs&lt;/strong&gt; folder.This is the folder where surface looks for application definitions.It maintains a list of applications listed here to load on demand by launcher.&lt;/p&gt;  &lt;p align="justify"&gt;Application’s definition file is a simple xml file which describes the application.Common elements included in the definition are &lt;/p&gt;  &lt;p&gt;&lt;u&gt;Title&lt;/u&gt; : Title&amp;#160; of the application     &lt;br /&gt;&lt;u&gt;Description&lt;/u&gt;:Description about application     &lt;br /&gt;&lt;u&gt;Executable&lt;/u&gt;: Path to exe.Path need to be absolute.     &lt;br /&gt;&lt;u&gt;IconImageFile&lt;/u&gt;:Icon of application.     &lt;br /&gt;&lt;u&gt;Preview&lt;/u&gt;: Preview images&lt;/p&gt;  &lt;p&gt;A sample xml file    &lt;br /&gt;&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;   &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ss:ApplicationInfo&lt;/span&gt;&lt;br /&gt; &lt;span style="color: #ff0000"&gt;xmlns:xsi&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: #ff0000"&gt;xmlns:ss&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/Surface/2007/ApplicationMetadata&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Application&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;Test Surface App&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;This is a test Surface application.&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Description&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ExecutableFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;%ProgramData%\Microsoft\Surface\Programs\SurfaceApplication1.exe&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ExecutableFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Arguments&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Arguments&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;IconImageFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;%ProgramData%\Microsoft\Surface\Programs\Resources\icon.png&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;IconImageFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Preview&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PreviewImageFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;%ProgramData%\Microsoft\Surface\Programs\Resources\iconPreview.png&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;PreviewImageFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Preview&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Application&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ss:ApplicationInfo&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-8567905734871594438?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3c2GPKB-eCxLWe5Z5cNfXOGgIt4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3c2GPKB-eCxLWe5Z5cNfXOGgIt4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3c2GPKB-eCxLWe5Z5cNfXOGgIt4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3c2GPKB-eCxLWe5Z5cNfXOGgIt4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/DvsNiZf4gX8/deploying-applications-in-microsoft.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/06/deploying-applications-in-microsoft.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-2257999501203925844</guid><pubDate>Sat, 30 May 2009 12:53:00 +0000</pubDate><atom:updated>2009-05-30T18:23:00.393+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Surface Development</category><category domain="http://www.blogger.com/atom/ns#">Surface</category><category domain="http://www.blogger.com/atom/ns#">Microsoft Surface</category><title>Changing the Orientation or Surface application</title><description>&lt;p&gt;Surface supports orientation of applications to 2 sides according to the seating position of the user.If we are developing applications we have to rotate our applications our self.Its done by checking the static property &lt;strong&gt;Microsoft.Surface.ApplicationLauncher.Orientation.&lt;/strong&gt;   &lt;br /&gt;There is an event called &lt;strong&gt;Microsoft.Surface.ApplicationLauncher.OrientationChanged &lt;/strong&gt;which fires when the user changes his side by clicking on the access buttons at the corresponding side.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Setting the Orientation&lt;/u&gt;&lt;/strong&gt;   &lt;br /&gt;We need to have a RotateTransform in our application whose Angle ,we are going to change according to the Orientation.Normally we place the RotateTransform in the root element of the SurfaceWindow.&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;   &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;s:SurfaceWindow&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;SurfaceApplication1.SurfaceWindow1&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #ff0000"&gt;xmlns:s&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/surface/2008&amp;quot;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #ff0000"&gt;Title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;SurfaceApplication1&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;MenuGrid&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid.LayoutTransform&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;RotateTransform&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;OrientationTransform&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Angle&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid.LayoutTransform&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;OrientationTextBox&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Center&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;s:SurfaceWindow&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Subscribe to the ApplicationLauncher.OrientationChanged event and set the Angle as per the ApplicationLauncher.Orientation property.&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;  &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; AddActivationHandlers()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #008000"&gt;// Subscribe to surface application activation events&lt;/span&gt;&lt;br /&gt;    ApplicationLauncher.ApplicationActivated += OnApplicationActivated;&lt;br /&gt;    ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;&lt;br /&gt;    ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;&lt;br /&gt;    ApplicationLauncher.OrientationChanged += ApplicationLauncher_OrientationChanged;&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ApplicationLauncher_OrientationChanged(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, OrientationChangedEventArgs e)&lt;br /&gt;{&lt;br /&gt;    OrientationTransform.Angle = ApplicationLauncher.Orientation == UserOrientation.Top ? 180 : 0;&lt;br /&gt;    OrientationTextBox.Text = ApplicationLauncher.Orientation.ToString();&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Using Triggers to change the Orientation or Surface application based on ApplicationLauncher.Orientation&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;  &lt;br /&gt;Its clear like water that we can’t use EventTrigger to set the Angle of Transform.Another method is PropertyTrigger.Since the ApplicationLauncher.Orientation is not an AttachedProperty we can’t use that method too.Simply saying we have to write code in order to achieve.I am searching for a method which does the same using xaml alone.If anybody finds,please share with me.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-2257999501203925844?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2-Pur2yT_Z3ahFwOsaJ34ts9RGE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2-Pur2yT_Z3ahFwOsaJ34ts9RGE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2-Pur2yT_Z3ahFwOsaJ34ts9RGE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2-Pur2yT_Z3ahFwOsaJ34ts9RGE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/UeX6wDAxBbI/changing-orientation-or-surface.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/05/changing-orientation-or-surface.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-3840216956924814216</guid><pubDate>Sun, 24 May 2009 06:58:00 +0000</pubDate><atom:updated>2009-05-24T12:28:00.509+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Surface Tag</category><category domain="http://www.blogger.com/atom/ns#">Surface</category><category domain="http://www.blogger.com/atom/ns#">Surface IdentityTag</category><category domain="http://www.blogger.com/atom/ns#">Microsoft Surface</category><title>Generating and Printing Surface IdentityTag</title><description>&lt;p&gt;Tags support is the most important feature in Microsoft Surface.Tags enable our application to recognize objects through surface.As you know there are 2 types of tags.Byte tag and identity tag.So before placing objects on the surface to recognize we have to print the tag and stick on the bottom part of the object.Then only surface can identify the tag value through its infrared sensing mechanism.There are 3 ways to visualize the tags.One is using the command line tool GenTag.exe and another using it’s visual tool &lt;em&gt;GenTagUI.exe&lt;/em&gt; and last using our own programs which make use of the class &lt;strong&gt;IdentityTagGenerator&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Using IdentityTag Image Generator&lt;/u&gt;&lt;/strong&gt;     &lt;br /&gt;Tool is located at&lt;/p&gt;  &lt;p&gt;[Install drive]:\Program Files\Microsoft SDKs\Surface\v1.0\Tools\GenTag\GenTag.exe&lt;/p&gt;  &lt;p&gt;Syntax :    &lt;br /&gt;&lt;em&gt;&lt;u&gt;GenTag.exe &amp;lt;Series&amp;gt; &amp;lt;Value&amp;gt; &amp;lt;FileName.png&amp;gt; [/dpi:number]&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Value and Series are in Hex.This tool outputs the tag as png image.Later we can print that image.Dots Per Inch (dpi) is optional.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Using IdentityTag printing tool&lt;/u&gt;&lt;/strong&gt;     &lt;br /&gt;Surface now includes a tool in it’s sdk which helps us to generate and print IdentityTags.You can locate the program in start menu itself&lt;/p&gt;  &lt;p&gt;Programs-&amp;gt;Microsoft Surface sdk 1.0 sp1-&amp;gt;Tools-&amp;gt;Identity Tag Printing Tool&lt;/p&gt;  &lt;p&gt;or in the location&lt;/p&gt;  &lt;p&gt;[Install drive]:\Program Files\Microsoft SDKs\Surface\v1.0\Tools\GenTag\GenTagUI.exe&lt;/p&gt;  &lt;p&gt;There is nothing to explain about using the tool I think.Try yourself.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;u&gt;Using IdentityTagGenerator class&lt;/u&gt;&lt;/strong&gt;    &lt;br /&gt;Microsoft has provided API to visualize the tags and later we can save or print them.The entry to tag visualization API is IdentityTagGenerator.That class contains 2 static methods for getting tag in it’s actual form.&lt;br/&gt; &lt;ul&gt;   &lt;li&gt;&lt;u&gt;Image GenerateTag(long series,long value)&lt;/u&gt; : As its signature implies, it returns the tag image according to parameters series and value.There is an overload available which takes dpi as parameter and returns image according to that. &lt;/li&gt;    &lt;li&gt;&lt;u&gt;RenderTag(long series,long value,Point point,Graphics g)&lt;/u&gt; :Draws identity tag on the Graphics object.Mainly targeted to be used in Windows forms applications.Also this helps in distributing tags through asp.net applications. &lt;/li&gt; &lt;/ul&gt; In the first method we can set the returned Image object as source of image control in our application.The second method uses Graphics object and that is available in OnPaint methods or we can create it using the Graphics class. &lt;/p&gt;  &lt;p&gt;The usage is straight forward.Seems there is no need to post a sample.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NB: Printed tag should be exactly 1.125 inches square in order to get detected by Surface.&lt;/strong&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-3840216956924814216?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8sjORyXsrXs4xP83yz1ed23NWNY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8sjORyXsrXs4xP83yz1ed23NWNY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8sjORyXsrXs4xP83yz1ed23NWNY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8sjORyXsrXs4xP83yz1ed23NWNY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/PynZos4GYp0/generating-and-printing-surface.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>1</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/05/generating-and-printing-surface.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-2171977470243667014</guid><pubDate>Wed, 20 May 2009 09:42:00 +0000</pubDate><atom:updated>2009-05-20T15:12:00.873+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Surface Development</category><category domain="http://www.blogger.com/atom/ns#">Surface</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><category domain="http://www.blogger.com/atom/ns#">Microsoft Surface</category><title>Introducing Surface SP1</title><description>&lt;p&gt;The first Service pack for Microsoft surface has released on May 10.It has got significant changes comparing to the older older.Here are the main features I noticed.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;New controls      &lt;ol&gt;       &lt;li&gt;ElementMenu &lt;/li&gt;        &lt;li&gt;LibraryBar &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Tagged object routing &lt;/li&gt;    &lt;li&gt;Improved contact visualization &lt;/li&gt;    &lt;li&gt;Improved access points &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;More details here   &lt;br /&gt;&lt;a title="http://blogs.msdn.com/surface/archive/2009/05/11/service-pack-1-officially-released-today.aspx" href="http://blogs.msdn.com/surface/archive/2009/05/11/service-pack-1-officially-released-today.aspx"&gt;http://blogs.msdn.com/surface/archive/2009/05/11/service-pack-1-officially-released-today.aspx&lt;/a&gt;    &lt;br /&gt;&lt;a title="http://arstechnica.com/microsoft/news/2009/05/microsoft-surface-sp1-adds-new-features.ars" href="http://arstechnica.com/microsoft/news/2009/05/microsoft-surface-sp1-adds-new-features.ars"&gt;http://arstechnica.com/microsoft/news/2009/05/microsoft-surface-sp1-adds-new-features.ars&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As a developer, I am more interested in the new controls and will be posting about them later.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-2171977470243667014?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wTvhrM8Px0d4ZaTanwl7khSusbQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wTvhrM8Px0d4ZaTanwl7khSusbQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wTvhrM8Px0d4ZaTanwl7khSusbQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wTvhrM8Px0d4ZaTanwl7khSusbQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/mJPQyTwrvec/introducing-surface-sp1.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>0</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/05/introducing-surface-sp1.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-8738925509492786332</guid><pubDate>Tue, 19 May 2009 06:24:00 +0000</pubDate><atom:updated>2009-05-19T11:54:27.209+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Template</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><category domain="http://www.blogger.com/atom/ns#">Style</category><category domain="http://www.blogger.com/atom/ns#">Custom Controls</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><title>WatermarkTextBox by inheriting TextBox</title><description>&lt;p&gt;I am very happy to see that my previous post “&lt;a href="http://joyfulwpf.blogspot.com/2009/02/wpf-watermark-textbox-using-xaml-style.html" target="_blank"&gt;WPF Watermark TextBox using XAML Style&lt;/a&gt;” helped a lot of peoples to solve their issues and currently that is the most popular post in my blog.That post describes about creating a WPF watermark textbox by changing it’s style.All the things are done in xaml and there is no property to set the water mark text.&lt;br/&gt;There was a requirement from one of the readers for such a property.ie a Watermark property which decides the watermark text.So rewriting the sample with that property.&lt;br/&gt; Here I just derived a new class called WatemarkTextBox from standard TextBox added a new dependency property called Watermark and defined default style for that control in generic.xaml.The steps are as follows&lt;/p&gt; &lt;ol&gt;   &lt;li&gt;Subclass TextBox and create a new class called WatermarkTextBox.&lt;/li&gt;   &lt;li&gt;Add a new DP called Watermark which is of type object.&lt;/li&gt;   &lt;li&gt;In the generic.xaml write the default style.&lt;/li&gt; &lt;/ol&gt; &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;   &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; WatermarkTextBox : TextBox&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; WatermarkTextBox()&lt;br /&gt;    {&lt;br /&gt;        DefaultStyleKeyProperty.OverrideMetadata(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(WatermarkTextBox),&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FrameworkPropertyMetadata(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(WatermarkTextBox)));&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; Watermark&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;)GetValue(WatermarkProperty); }&lt;br /&gt;        set { SetValue(WatermarkProperty, &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;); }&lt;br /&gt;    }&lt;br /&gt;    &lt;span style="color: #008000"&gt;// Using a DependencyProperty as the backing store for Watermark.  This enables animation, styling, binding, etc...&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; DependencyProperty WatermarkProperty = DependencyProperty.Register(&lt;br /&gt;        &lt;span style="color: #006080"&gt;&amp;quot;Watermark&amp;quot;&lt;/span&gt;, &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;), &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(WatermarkTextBox), &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; UIPropertyMetadata(&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;));&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;And its style in generic.xaml contains almost same elements as of my last post.But here I have used TemplateBinding to set Watermark into the TextBlock.&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;&lt;br /&gt;  &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TargetType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{x:Type local:WatermarkTextBox}&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Foreground&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Background&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{DynamicResource {x:Static SystemColors.WindowBrushKey}}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;BorderBrush&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Blue&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;BorderThickness&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Padding&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;AllowDrop&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;FocusVisualStyle&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{x:Null}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Template&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter.Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ControlTemplate&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TargetType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{x:Type local:WatermarkTextBox}&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Microsoft_Windows_Themes:ListBoxChrome&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Bd&amp;quot;&lt;/span&gt;&lt;br /&gt;                                                            &lt;span style="color: #ff0000"&gt;SnapsToDevicePixels&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;br /&gt;                                                            &lt;span style="color: #ff0000"&gt;Background&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding Background}&amp;quot;&lt;/span&gt;&lt;br /&gt;                                                            &lt;span style="color: #ff0000"&gt;BorderBrush&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding BorderBrush}&amp;quot;&lt;/span&gt;&lt;br /&gt;                                                            &lt;span style="color: #ff0000"&gt;BorderThickness&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding BorderThickness}&amp;quot;&lt;/span&gt;&lt;br /&gt;                                                            &lt;span style="color: #ff0000"&gt;RenderFocused&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding IsKeyboardFocusWithin}&amp;quot;&lt;/span&gt;&lt;br /&gt;                                                            &lt;span style="color: #ff0000"&gt;RenderMouseOver&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding IsMouseOver}&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ScrollViewer&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;PART_ContentHost&amp;quot;&lt;/span&gt;&lt;br /&gt;                                      &lt;span style="color: #ff0000"&gt;SnapsToDevicePixels&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding SnapsToDevicePixels}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Microsoft_Windows_Themes:ListBoxChrome&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;textBlock&amp;quot;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color: #ff0000"&gt;Opacity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;0.345&amp;quot;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{TemplateBinding Watermark}&amp;quot;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color: #ff0000"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Wrap&amp;quot;&lt;/span&gt;&lt;br /&gt;                               &lt;span style="color: #ff0000"&gt;Visibility&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Hidden&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ControlTemplate.Triggers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;MultiTrigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;MultiTrigger.Conditions&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Condition&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;IsFocused&amp;quot;&lt;/span&gt;&lt;br /&gt;                                       &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;False&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Condition&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Text&amp;quot;&lt;/span&gt;&lt;br /&gt;                                       &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;MultiTrigger.Conditions&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Property&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Visibility&amp;quot;&lt;/span&gt;&lt;br /&gt;                                &lt;span style="color: #ff0000"&gt;TargetName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;textBlock&amp;quot;&lt;/span&gt;&lt;br /&gt;                                &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Visible&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;MultiTrigger&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ControlTemplate.Triggers&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ControlTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter.Value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Setter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Download sample from &lt;a href="http://cid-890c06c8106550a0.skydrive.live.com/self.aspx/BlogSamples/JoyfulWPF/WatermarkTextBox.zip" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8422996711799977570-8738925509492786332?l=joyfulwpf.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KKN4X43GJOgdaKZphPvRr4smHQE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KKN4X43GJOgdaKZphPvRr4smHQE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KKN4X43GJOgdaKZphPvRr4smHQE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KKN4X43GJOgdaKZphPvRr4smHQE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://feedproxy.google.com/~r/Joyfulwpf/~3/E_mZU3XrHWw/watermarktextbox-by-inheriting-textbox.html</link><author>noreply@blogger.com (Joy George)</author><thr:total>7</thr:total><feedburner:origLink>http://joyfulwpf.blogspot.com/2009/05/watermarktextbox-by-inheriting-textbox.html</feedburner:origLink></item></channel></rss>

