<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8422996711799977570</atom:id><lastBuildDate>Fri, 09 Jan 2026 15:33:24 +0000</lastBuildDate><category>WPF</category><category>XAML</category><category>Controls</category><category>Databinding</category><category>Template</category><category>Tips</category><category>MVVM</category><category>Blend</category><category>Style</category><category>Microsoft Surface</category><category>Surface</category><category>C#</category><category>Custom Controls</category><category>WPF3D</category><category>Surface Development</category><category>WPF Training</category><category>Triggers</category><category>Application Architecture</category><category>Common Code Base</category><category>Markup extension</category><category>Surface Tag</category><category>XAML 2009</category><category>.Net 4</category><category>BitmapEffect</category><category>DataTemplate</category><category>Design Time</category><category>Interactions</category><category>Lambda Expressions</category><category>Mediator Pattern</category><category>OpacityMask</category><category>Performance</category><category>Transform</category><category>.Net 3.5</category><category>Attached Event</category><category>Behaviors</category><category>Books</category><category>Bug</category><category>Debugging</category><category>Dependency Property</category><category>INotifyPropertyChanged</category><category>Interoperability</category><category>Linq</category><category>Linux</category><category>MCTS</category><category>Path</category><category>Pixel Shader Effects</category><category>Surface IdentityTag</category><category>Surface simulator</category><category>Vista</category><category>Visual State Manager</category><category>Visual Tree</category><category>WCF</category><category>WinRT</category><category>Windows Forms</category><category>XBAP</category><title>Joymon&#39;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 (Joymon)</managingEditor><generator>Blogger</generator><openSearch:totalResults>105</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-2911453512971208577</guid><pubDate>Thu, 23 Jul 2015 01:30:00 +0000</pubDate><atom:updated>2015-07-23T07:00:00.272+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WPF</category><title>WPF is dying - Time to focus on HTML+Javascript+CSS based desktop development</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&quot;Long long ago when browsers were only used to show documents and text delivered from servers, there was a technology called Silverlight which was released by Microsoft to compete with another technology called Flash. Flash was used to add some flashy animations into static web contents and to play video and audio files...&quot;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This must be a story I will be telling to my son when he wants me to tell technology stories. As everybody knows Silverlight is now dead though Visual Studio 2015 is still giving project template. I was one of the developers who learned and developed from the very first preview version of Silverlight itself. Also successfully run a blog called &lt;a href=&quot;http://silverlightedweb.blogspot.com/&quot;&gt;Silverlighted Web&lt;/a&gt; and earned so much money with my Silverlight skill. What caused SL to die?&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
It was simple as the gap was filled by HTML5. Silverlight / other RIA technologies were kind of workaround to achieve Rich Internet Apps because HTML, till 4th version was just for content / document markup, not for applications. Once HTML5 came with capabilities to develop applications , obviously RIA technologies were all dead including Silverlight, Flash etc...At least in case of Flash , Adobe announced officially and provided &lt;a href=&quot;http://www.adobe.com/inspire/2014/02/flash-html5-canvas.html&quot;&gt;migration to HTML5&lt;/a&gt;. MSFT is still not announced SL is dead.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;When HTML5 arrived, smart people foresee the death of Silverlight and moved to HTML5. But there were still people who &lt;/span&gt;&lt;a href=&quot;https://draft.blogger.com/&quot; style=&quot;text-align: left;&quot;&gt;&lt;span id=&quot;goog_1248158337&quot;&gt;&lt;/span&gt;believed &lt;span id=&quot;goog_1248158338&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;text-align: left;&quot;&gt;SL will &lt;/span&gt;&lt;a href=&quot;http://weblogs.asp.net/scottgu/silverlight-questions&quot; style=&quot;text-align: left;&quot;&gt;live longer&lt;/a&gt;&lt;span style=&quot;text-align: left;&quot;&gt; and MSFT will invest on it &lt;/span&gt;&lt;a href=&quot;http://www.ingebrigtsen.info/2010/11/01/the-fall-and-rise-of-microsofts-ux-platform-pun-intended/&quot; style=&quot;text-align: left;&quot;&gt;because their Azure Portal was using Silverlight&lt;/a&gt;&lt;span style=&quot;text-align: left;&quot;&gt;. Microsoft is a group of smarter people than us and all of a&lt;/span&gt;&lt;a href=&quot;http://www.itwriting.com/blog/5948-microsofts-scott-guthrie-on-what-has-happened-to-silverlight.html&quot; style=&quot;text-align: left;&quot;&gt; sudden they launched&lt;/a&gt;&lt;span style=&quot;text-align: left;&quot;&gt; their Azure portal in HTML5 and slowly ditched Azure SL portal.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Lets come back to WPF. There were speculations on WPF is going to die when Microsoft first announced that we can build &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/windows/apps/BR211385.aspx?f=255&amp;amp;MSPPError=-2147217396&quot;&gt;Windows 8 desktop apps using HTML5&lt;/a&gt; &amp;amp; Javascript. There were people who argued MSFT won&#39;t kill WPF because Visual Studio &amp;amp; Expression Blend &lt;/span&gt;&lt;a href=&quot;http://www.riagenic.com/archives/963&quot; style=&quot;text-align: left;&quot;&gt;are built&lt;/a&gt;&lt;span style=&quot;text-align: left;&quot;&gt; using WPF. There is a road map published in &lt;/span&gt;&lt;a href=&quot;http://blogs.msdn.com/b/dotnet/archive/2014/11/12/the-roadmap-for-wpf.aspx&quot; style=&quot;text-align: left;&quot;&gt;.Net MSDN blog&lt;/a&gt;&amp;nbsp;as well&lt;span style=&quot;text-align: left;&quot;&gt;. According to me there are less chances that anybody will maintain a technology only because of one product.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Yes, Microsoft cannot rewrite Visual Studio using other technology between 2 versions as its desktop application and there are many plugins out there. It was different with Silverlight based Azure portal as it was web, single instance and nobody had written plugin on top of it.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Am I telling that Visual Studio is rewritten using some other technology which eventually kill WPF&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Yes it is happening, but as small pieces here and there. First Visual Studio Online came. We can use it to manage our TFS projects. We can do all most all the project management activities which we were doing from VS desktop app. Only thing pending is writing code, compiling &amp;amp; debugging. People can argue VS desktop is for coding and debugging only. So what is the problem?&lt;/div&gt;
&lt;br /&gt;
The big thing happened during the Build 2015. MSFT announced something called &lt;a href=&quot;https://en.wikipedia.org/wiki/Visual_Studio_Code&quot;&gt;Visual Studio Code&lt;/a&gt;. What is it and what is it for WPF?&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
According to &lt;a href=&quot;https://en.wikipedia.org/wiki/Visual_Studio_Code&quot;&gt;wiki&lt;/a&gt;, it is a source code editor for Windows and Linux and OS X. What is the distance between source code editor and IDE? Its simple as Compile, Run and Debug capabilities. That can be done using &lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;VS Code&lt;/a&gt;&amp;nbsp;also. They says its &quot;Code Editing. Redefined&quot;.&amp;nbsp;Why they call it as VS Code? Why the existing Visual Studio is not enhanced to &#39;redefined code editing&#39;? Why they are calling it as VS Code, a separate name? Is it only because, it can run on other operating systems such as Linux and OS X.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
According to me, MSFT is once again showing that HTML+Javascript+CSS is the future by introducing a Electron based Visual Studio. Don&#39;t&amp;nbsp;get shocked on hearing the new redefined code editor aka &lt;b&gt;Visual Studio from MSFT is based on &lt;a href=&quot;http://electron.atom.io/&quot;&gt;Electron &lt;/a&gt;&amp;nbsp;which is&amp;nbsp;an open source cross platform technology for desktop application development using web technologies(HTML,Javascript) from Github which depends on &lt;a href=&quot;https://www.chromium.org/&quot;&gt;Chromium&lt;/a&gt;&lt;/b&gt;. Yes the same technology powering Chrome browser from &lt;b&gt;Google&lt;/b&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Electron has high degree of customization (hackable to the core) as an editor. Chromium is really stable with its multi process model. Its all proven and now we can see, VS Code download link in the &lt;a href=&quot;https://www.visualstudio.com/downloads/download-visual-studio-vs&quot;&gt;VS 2015 page&lt;/a&gt;.&lt;/div&gt;
&lt;br /&gt;
Is there any more proof required to understand, HTML5 based VS Code will replace existing WPF based Visual Studio? We probably will see &lt;a href=&quot;http://www.visualstudio.com/&quot;&gt;VisualStudio online&lt;/a&gt; providing us a web page where we can write code, compile and debug in next 5 years along with its current project management features.&lt;br /&gt;
&lt;br /&gt;
Will .Net platform survive the boom of Javascript and Microsoft&#39;s journey to become hosting company? Will write another post on the same&lt;br /&gt;
&lt;hr /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This will be my last post on this WPF technology blog. This is the blog I will surely write posts on WPF as and when I encounter interesting scenarios. But those will be published in my General Technology Blog.
&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://joymonscode.blogspot.com/&quot; style=&quot;font-size: 19px; font-weight: bold;&quot;&gt;Joymon v/s Code&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Don&#39;t argue that I am writing all these because I want to focus only on one blog. It doesn&#39;t make any difference posting here or there.&lt;/div&gt;
</description><link>http://joyfulwpf.blogspot.com/2015/07/wpf-is-dying-time-to-focus-on.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>13</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-8269488911849863456</guid><pubDate>Thu, 31 Jul 2014 11:00:00 +0000</pubDate><atom:updated>2014-07-31T16:30:00.364+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">MVVM</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><title>MVVm views without C# code behind file</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The MVVm is a great technique for separating the concerns. If we take ASP.Net MVC we can see it is built for using model view controller model. So by default wont allow us to write code behind for the views (We can write inside the cshtml though). But WPF as the technology was not built to use WPF to there is no in-built way to avoid the code behind of views.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
If the development team is so technology focused, it doesn&#39;t matter as they won&#39;t break the rules of MVVm even if there is code behind file. But since companies are offshoring to get cheap labor, enforcing quality is little tricky. As always cheap things comes with less quality. Most of the time people&#39;s priority is to get things done in quick way ie by writing everything in code behind instead of going through viewmodel.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The challenge here is how to bring quality with these less skilled labor? One of the way to enforce viewmodel &amp;nbsp;usage is to delete the code behind of views which is nothing but the user controls.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
If we just remove the usercontrol.xaml.cs, it will fail as the Initialize method is missing. So how to overcome is?&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Add the Initialize method in the view itself. Yes we can &lt;a href=&quot;http://joyfulwpf.blogspot.com/2012/02/mvvm-embed-c-code-in-xaml-like-aspnet.html&quot;&gt;write C# code in XAML&lt;/a&gt;. So the view user control will look as follows.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;background: rgb(30, 30, 30); font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;UserControl&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;x&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;Class&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;Joymons.MVVmDemo.Views.MainView&quot;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;xmlns&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;xmlns&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;xmlns&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;mc&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;xmlns&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;d&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;http://schemas.microsoft.com/expression/blend/2008&quot;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;mc&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;Ignorable&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;d&quot;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;d&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;DesignHeight&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;300&quot;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;d&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;DesignWidth&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;300&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;Code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #c0d088;&quot;&gt;&amp;lt;![CDATA[&amp;nbsp;public&amp;nbsp;MainView()&amp;nbsp;{&amp;nbsp;InitializeComponent();&amp;nbsp;}]]&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;Code&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;TabControl&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;ItemsSource&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: #bba08c;&quot;&gt;Binding&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;&amp;nbsp;ChildVMs&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;SelectedIndex&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;0&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;TabControl.ItemTemplate&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;DataTemplate&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;TextBlock&lt;/span&gt;&lt;span style=&quot;color: #92caf4;&quot;&gt;&amp;nbsp;Text&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: #bba08c;&quot;&gt;Binding&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;&amp;nbsp;Header&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;DataTemplate&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;TabControl.ItemTemplate&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #ababab;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;TabControl&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #e6e6e6;&quot;&gt;UserControl&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: gainsboro;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
I too started using VS 2013. That is why a black background in the code :)&lt;/div&gt;
</description><link>http://joyfulwpf.blogspot.com/2014/07/mvvm-views-without-c-code-behind-file.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-6902627683889616435</guid><pubDate>Thu, 03 Jul 2014 00:49:00 +0000</pubDate><atom:updated>2014-07-03T06:19:59.213+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Databinding</category><category domain="http://www.blogger.com/atom/ns#">MVVM</category><title>Binding Viewmodel property to tabitem header in MVVm pattern</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Its been a while since I started a WPF project from scratch. I was mainly into the architectural side of application rather than UI side. Today I got an opportunity to start one app. It is supposed to be simple WPF application where the screens are arranged in hierarchical tabs.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The application is supposed to be a temporary application which will be used to test an algorithm developed by the business before its getting integrated into the actual application. So thought of not following the MVVm pattern as its supposed to be developed from our offshore in less amount of time. But one discussion with my lead architect changed my decision. If we are doing something we should do it right. We don&#39;t know whether the client will get rid of the application if it feels too good for them. Finally decided to go with MVVm.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The initial decision I had to take about the MVVm infrastructure. Earlier when I used to start the project I take my own RelayCommand,ViewmodelBase classes. That was the beginning time of WPF. But this time I decided to use a good library on the assumption that the MVVm framework must be matured by now. It ends up in using &lt;a href=&quot;https://www.nuget.org/packages/MvvmLight/&quot;&gt;MVVM Light&lt;/a&gt;. Its a nice library which we can get from nuget.&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Then started thinking about the UI structure where the tabs needs to be shown in hierarchical way. Its nothing but there will be one parent level tab control and in every tab page there will be one more tab control. I created the view models and bound to the view. Each high level view model have ChildVMs collection. In the MainPage.xaml UI I was able to bound to the ChildVMs property and they showed up as each and every viewmodel was associated with data template.&lt;/div&gt;
&lt;hr /&gt;
&lt;pre style=&quot;background: white; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Application.Resources&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;DataTemplate&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;DataType&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Type&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;vms&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ChildViewmodel_1&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;vws&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;ChildViewUserControl_1&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;DataTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Application.Resources&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;hr /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
But I faced one problem. I could see that the tab headers are also showing the same control which is inside the tab page. Ideally I need to edit the tab header template and bind to the header property in the viewmodel. But I could see one more way which is just a data template for the tab item.&lt;/div&gt;
&lt;hr /&gt;
&lt;pre style=&quot;background: white; font-family: Consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;TabControl&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;ItemsSource&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Binding&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;ChildVMs&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;TabControl.ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;!-- This template applies to the header of tab item --&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;DataTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;!--Header property is clr property in view model--&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;TextBlock&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;{&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Binding&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;nbsp;Header&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;DataTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;TabControl.ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;TabControl&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;hr /&gt;
Happy coding&lt;/div&gt;
</description><link>http://joyfulwpf.blogspot.com/2014/07/binding-viewmodel-property-to-tabitem.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-1213529972578974793</guid><pubDate>Wed, 18 Jul 2012 17:47:00 +0000</pubDate><atom:updated>2012-07-18T23:28:15.430+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Microsoft Surface</category><category domain="http://www.blogger.com/atom/ns#">WinRT</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</category><title>Index - Important WPF concepts &amp;amp; features</title><description>&lt;div style=&quot;text-align: left&quot; dir=&quot;ltr&quot; trbidi=&quot;on&quot;&gt;Recently, I came across a scenario where I had to explain the WPF features to one person. I didn&#39;t get a common place where I can see a list of all WPF features. Now I would really like to call this as WPF cheat sheet where I can brush up my WPF skills.    &lt;br /&gt;    &lt;ul style=&quot;text-align: left&quot;&gt;     &lt;li&gt;WPF basics        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms750441.aspx&quot;&gt;Architecture&lt;/a&gt; of &lt;a href=&quot;http://a1ashiish-csharp.blogspot.in/2012/03/wpf-architecture-overview-of-windows.html&quot;&gt;WPF&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;Designer / Developer /Integrator &lt;a href=&quot;http://windowsclient.net/wpf/white-papers/thenewiteration.aspx&quot;&gt;interaction&lt;/a&gt; &lt;a href=&quot;http://wpftutorial.net/Workflow.html&quot;&gt;workflow&lt;/a&gt;. &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc337899.aspx&quot;&gt;Vector&lt;/a&gt;&amp;#160;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms748373.aspx&quot;&gt;graphics&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms752059.aspx&quot;&gt;Declarative&lt;/a&gt; &lt;a href=&quot;http://blogs.windowsclient.net/rob_relyea/archive/2008/11/06/the-8-benefits-of-xaml-for-ui-and-beyond.aspx&quot;&gt;XAML&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/05/25/Compiled-XAML-_3D00_-BAML-not-IL.aspx&quot;&gt;Compiled&lt;/a&gt; &lt;a href=&quot;http://wpftutorial.net/baml.html&quot;&gt;BAML&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;WPF &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa970678.aspx&quot;&gt;build&lt;/a&gt; sequence. &lt;/li&gt;          &lt;li&gt;Rendering - &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms742196.aspx&quot;&gt;Hardware&lt;/a&gt; and &lt;a href=&quot;http://blogs.msdn.com/b/jgoldb/archive/2010/06/22/software-rendering-usage-in-wpf.aspx&quot;&gt;Software&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;Application models        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa970060.aspx&quot;&gt;XBAP&lt;/a&gt; - &lt;a href=&quot;http://en.wikipedia.org/wiki/XAML_Browser_Applications&quot;&gt;WPF app in Browser&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.paulstovell.com/wpf-navigation&quot;&gt;Paged&lt;/a&gt; &lt;a href=&quot;http://www.c-sharpcorner.com/uploadfile/kaps_deo/create-navigation-based-application-in-wpf/&quot;&gt;navigation&lt;/a&gt; and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms748948.aspx&quot;&gt;Window&lt;/a&gt; applications &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;New concepts        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms741870&quot;&gt;Dispatcher&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/apps/hh700353.aspx&quot;&gt;Dependency&lt;/a&gt; &lt;a href=&quot;http://www.codeproject.com/Articles/140620/WPF-Tutorial-Dependency-Property&quot;&gt;property&lt;/a&gt;             &lt;ul&gt;             &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms743230.aspx&quot;&gt;Precedence in value calculation&lt;/a&gt; &lt;/li&gt;           &lt;/ul&gt;         &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/b/bencon/archive/2006/07/24/677520.aspx&quot;&gt;Attached properties&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms742806.aspx&quot;&gt;Routed&lt;/a&gt; &lt;a href=&quot;http://wpftutorial.net/RoutedEvents.html&quot;&gt;Events&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb613550.aspx&quot;&gt;Attached&lt;/a&gt; events &amp;amp; &lt;a href=&quot;http://en.csharp-online.net/WPF_Concepts%E2%80%94Attached_Events&quot;&gt;usage&lt;/a&gt; &lt;a href=&quot;http://serialseb.blogspot.in/2007/01/attached-events-by-example-adding.html&quot;&gt;example&lt;/a&gt;. &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;User interface        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://wpftutorial.net/LogicalAndVisualTree.html&quot;&gt;Visual&lt;/a&gt; tree &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms753391.aspx&quot;&gt;and&lt;/a&gt; logical &lt;a href=&quot;http://www.codeproject.com/Articles/21495/Understanding-the-Visual-Tree-and-Logical-Tree-in&quot;&gt;tree&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://manaspatnaik.com/blog/index.php/technology/wpf/layout-and-controls-in-wpf/259&quot;&gt;Controls&lt;/a&gt; &lt;a href=&quot;http://wpftutorial.net/LayoutProperties.html&quot;&gt;layout&lt;/a&gt;             &lt;ul&gt;             &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms754152.aspx&quot;&gt;Panels&lt;/a&gt; &lt;/li&gt;              &lt;li&gt;&lt;a href=&quot;http://www.switchonthecode.com/tutorials/wpf-tutorial-creating-a-custom-panel-control&quot;&gt;MeasureOverride and ArrangeOverride&lt;/a&gt; &lt;/li&gt;              &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb613548.aspx&quot;&gt;Content&lt;/a&gt; &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb613548.aspx&quot;&gt;model&lt;/a&gt; &lt;/li&gt;           &lt;/ul&gt;         &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.japf.fr/2009/10/wpf-internals-part-1-what-are-the-core-wpf-classes/&quot;&gt;Controls class hierarchy&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14340/Creating-a-look-less-custom-control-in-WPF&quot;&gt;Look-less&lt;/a&gt;&amp;#160;&lt;a href=&quot;http://wpftutorial.net/HowToCreateACustomControl.html&quot;&gt;custom controls&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms752347.aspx&quot;&gt;Databinding&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/15822/Bind-Better-with-INotifyPropertyChanged&quot;&gt;Change notification &lt;/a&gt;using &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx&quot;&gt;INotifyPropertyChanged&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.e-pedro.com/2009/04/an-introduction-to-observablecollection-in-wpf/&quot;&gt;ObservableCollection&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.hardcodet.net/2008/04/wpf-custom-binding-class&quot;&gt;Binding&lt;/a&gt; &lt;a href=&quot;http://joyfulwpf.blogspot.in/2008/12/creating-custom-wpf-markup-extension-to.html&quot;&gt;markup extensions&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms752308.aspx&quot;&gt;Commands&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/&quot;&gt;Routed&lt;/a&gt; &lt;a href=&quot;http://www.digdes.com/art/136-wpf-routed-commands&quot;&gt;Commands&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/b/mikehillberg/archive/2009/03/20/icommand-is-like-a-chocolate-cake.aspx&quot;&gt;ICommand&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.switchonthecode.com/tutorials/wpf-tutorial-command-bindings-and-custom-commands&quot;&gt;Command Binding&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.input.inputbinding.aspx&quot;&gt;InputBindings&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://drwpf.com/blog/2009/05/12/itemscontrol-l-is-for-lookless/#IntroToTriggers&quot;&gt;Triggers&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;Property Trigger &lt;/li&gt;          &lt;li&gt;Data &lt;/li&gt;          &lt;li&gt;Event trigger &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms750613.aspx&quot;&gt;Resources&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/03/creating-and-consuming-resource-dictionaries-in-wpf-and-silverlight.aspx&quot;&gt;Resource Dictionary&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://joyfulwpf.blogspot.in/2008/07/about-pack-uri-style.html&quot;&gt;Pack uri&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://wpftutorial.net/Styles.html&quot;&gt;Style&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;Templates        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://wpftutorial.net/templates.html&quot;&gt;Control Template&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://wpftutorial.net/DataTemplates.html&quot;&gt;Data&lt;/a&gt; &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms742521.aspx&quot;&gt;template&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.itemspaneltemplate.aspx&quot;&gt;ItemsPanelTemplate&lt;/a&gt; &lt;a href=&quot;http://drwpf.com/blog/2008/02/10/itemscontrol-p-is-for-panel/&quot;&gt;for&lt;/a&gt; &lt;a href=&quot;http://blah.winsmarts.com/2007-3-WPF__The_ItemsPanelTemplate_-_controlling_how_ListBox-ComboBox_etc_render_their_children.aspx&quot;&gt;ItemsControl&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.visualstatemanager.aspx&quot;&gt;VSM &lt;/a&gt;- &lt;a href=&quot;http://miteshsureja.blogspot.in/2011/05/visual-state-manager-new-feature-in.html&quot;&gt;Visual&lt;/a&gt; State &lt;a href=&quot;http://blogs.msdn.com/b/wpfsdk/archive/2009/02/27/the-visualstatemanager-and-triggers.aspx&quot;&gt;Manager&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;Graphics        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/b/wpfsdk/archive/2007/02/05/using-bitmap-effects-to-create-drop-shadows-outer-glows-etc.aspx&quot;&gt;Bitmap&lt;/a&gt;&amp;#160;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms743435.aspx&quot;&gt;effects&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;2D &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms750596.aspx&quot;&gt;Transforms&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://pwlodek.blogspot.in/2011/11/wpf-transitions-using-pixel-shaders-and.html&quot;&gt;Pixel&lt;/a&gt; &lt;a href=&quot;http://joyfulwpf.blogspot.in/2009/03/writing-custom-pixel-shader-effects.html&quot;&gt;shaders&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms747393.aspx&quot;&gt;Shape&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms752293.aspx&quot;&gt;Path&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms751808.aspx&quot;&gt;Geometry&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa970904.aspx&quot;&gt;Brushes&lt;/a&gt; &amp;amp; Opacity &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://joyfulwpf.blogspot.in/2009/05/understanding-opacitymask-and-its-usage.html&quot;&gt;Opacity Mask&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/b/bsinghal/archive/2007/12/11/wpf-using-the-inkcanvas-control.aspx&quot;&gt;InkCanvas&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.inkpresenter.aspx&quot;&gt;InkPresenter&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms752312.aspx&quot;&gt;Animation&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/b/maximelamure/archive/2009/11/10/add-easing-effects-on-your-animations-with-wpf-4-easing-functions.aspx&quot;&gt;Easing &lt;/a&gt;function for animation &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.wpftutorial.net/introductionto3d.html&quot;&gt;Viewport3D&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms753347.aspx&quot;&gt;3D transforms&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms748388.aspx&quot;&gt;Documents&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://highoncoding.com/Articles/461_Creating_FixedDocument_in_WPF_Using_Custom_Collection.aspx&quot;&gt;Fixed document&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc163371.aspx&quot;&gt;Flow&lt;/a&gt;&amp;#160;&lt;a href=&quot;http://www.codeproject.com/Articles/37368/WPF-Flow-Document-For-Beginners&quot;&gt;document&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc163664.aspx&quot;&gt;XPS&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;Patterns        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/dd419663.aspx&quot;&gt;MVVm&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.intertech.com/Blog/Post/7-Things-You-Need-to-Know-Before-Starting-a-Prism-WPF-Project.aspx&quot;&gt;Composite application guidance&lt;/a&gt;&amp;#160;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc785479.aspx&quot;&gt;Prism&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://joyfulwpf.blogspot.in/2010/06/common-code-base-1-introduction.html&quot;&gt;Common code base&lt;/a&gt; for WPF and Silverlight &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms788718.aspx&quot;&gt;Localization&lt;/a&gt;.         &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/37339/WPF-Localization&quot;&gt;BAML&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://www.wpftutorial.net/localizemarkupextension.html&quot;&gt;Using Binding extension&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/33076/WPF-Printing-Basic-Text-Printing&quot;&gt;Printing&lt;/a&gt; &lt;a href=&quot;http://www.c-sharpcorner.com/uploadfile/mahesh/printing-in-wpf/&quot;&gt;documents&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;Interoperability        &lt;ul&gt;         &lt;li&gt;&lt;a href=&quot;http://www.switchonthecode.com/tutorials/wpf-tutorial-using-wpf-in-winforms&quot;&gt;ElementHost&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://mindstick.com/Articles/e87470a2-1aac-4d2a-a645-f3d9e90ba555/?WindowsFormsHost%20control%20in%20WPF&quot;&gt;WindowsFormsHost&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa970683&quot;&gt;Performance&lt;/a&gt; optimization &lt;/li&gt;      &lt;li&gt;Tools        &lt;ul&gt;         &lt;li&gt;Snoop &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://wpfinspector.codeplex.com/&quot;&gt;WPF Inspector&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms727247.aspx&quot;&gt;UISpy&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa348104.aspx&quot;&gt;isXPS&lt;/a&gt; &lt;/li&gt;          &lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa969767.aspx&quot;&gt;WPF Performance suit&lt;/a&gt;             &lt;ul&gt;             &lt;li&gt;Perforator &lt;/li&gt;              &lt;li&gt;Visual Profiler &lt;/li&gt;           &lt;/ul&gt;         &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;      &lt;li&gt;&lt;a href=&quot;http://10rem.net/blog/2010/10/28/the-present-and-future-of-wpf&quot;&gt;Future of WPF&lt;/a&gt;         &lt;ul&gt;         &lt;li&gt;&lt;strike&gt;WPF&lt;/strike&gt;&amp;#160;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/apps/hh986965.aspx&quot;&gt;XAML in Windows 8&lt;/a&gt; &lt;/li&gt;       &lt;/ul&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;div&gt;The sad thing I could forecast is, as the WinRT model becomes popular and available in different platforms such as WinRT tablets, surface, windows mobile, Windows 8, future OS and other devices etc...,WPF will decline to desktop computers and rest in history. After naming the &lt;a href=&quot;http://www.microsoft.com/surface/en/us/default.aspx&quot;&gt;tablet as Surface&lt;/a&gt;, it seems Microsoft is trying to bring single platform for all devices under the &lt;a href=&quot;http://reviews.cnet.com/tablets/microsoft-surface-rt/4505-3126_7-35332494.html&quot;&gt;Surface brand&lt;/a&gt; same as Google did using Android. Hope you got why I wrote this index post.&lt;/div&gt; &lt;/div&gt;  </description><link>http://joyfulwpf.blogspot.com/2012/07/index-important-wpf-concepts-features.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-5522870059233963563</guid><pubDate>Wed, 20 Jun 2012 17:57:00 +0000</pubDate><atom:updated>2012-06-20T23:27:00.494+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Application Architecture</category><category domain="http://www.blogger.com/atom/ns#">C#</category><title>Drag and drop files from WPF to desktop using C#.Net</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;justify&quot;&gt;
This is not only applicable to WPF but also to Windows forms applications. When I meant desktop it applies to any folder opened in windows explorer. ie the folders which we interact with for drag and drop. The scenario here is simple. We have a remote file system accessible via WCF services and showing the files and folders in the front end WPF app. It has options to upload ,download,check-out, check in etc…As part of improving usability we decided to give drag and drop facility to the screens.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;strong&gt;&lt;u&gt;Some facts about .Net drag and drop&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
Here are the facts about .Net file drag and drop. We cannot manipulate the file contents during the drag operation. It works only with physical files. ie we should give the drag and drop system a physical file name to start drag and drop into windows explorer or desktop. May be one reason is once the dragging mouse leaves the .Net application it is controlled by the native system ie the windows.&lt;/div&gt;
&lt;strong&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;The drag and drop design&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
The above facts tells us that we can only imitate a file drag start just like it is started from windows explorer. So we should design accordingly and it is simple. As long as the .Net file drag and drop works only with the files, we should download the file before we call the DoDragAndDrop method. Is it good to download when the user starts dragging? No.So give an indication that the file is being downloaded to the client side repository /cache /temp location and allow dragging on the files which are downloaded fully.&lt;/div&gt;
The &lt;a href=&quot;https://www.dropbox.com/s/xx73k7ek9qsvge9/DragDrop2Desktop.zip&quot;&gt;attached sample&lt;/a&gt; contains code which puts a in-memory file entity to temp folder when the dragging starts and routes the source of dragging to the file which is created in temp.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;When should I call DoDragDrop&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
I had tried from so many places and succeeded when I called from PreviewLeftMouseButtonDown. This will block all the other operations on the mouse down operation context.&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;Code to drag and drop to explorer&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
If you look at the same you will get a clear idea how I achieved this .The FileEntry is just a class to hold the data and file name. Upon mouse event I wrote to a temp location and starts dragging using that file path. ie simply initiating a drag which we do among normal windows explorer windows.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Grid_PreviewMouseLeftButtonDown(&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, MouseButtonEventArgs e)
{
    FrameworkElement senderElement = (sender &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; FrameworkElement);
    &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (senderElement != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)
    {
        FileEntry file = senderElement.DataContext &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; FileEntry;
        &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (file != &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;)
        {
            &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; fullPath = Write2TempAndGetFullPath(file);
            &lt;span style=&quot;color: green;&quot;&gt;//TODO : If you want to delete you need to use FileWatchers to catch the drop events and delete from temp.&lt;/span&gt;
            &lt;span style=&quot;color: green;&quot;&gt;//But as long as it is temp the users/admins can delete it when required.&lt;/span&gt;
            DataObject dragObj = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataObject();
            dragObj.SetFileDropList(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; System.Collections.Specialized.StringCollection() { fullPath });
            DragDrop.DoDragDrop(senderElement, dragObj, DragDropEffects.Copy);
        }
    }
}
&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; Write2TempAndGetFullPath(FileEntry file)
{
    &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; tempFilePath=System.IO.Path.Combine(_tempFolder,file.FileName);
    Stream fs=File.Create(tempFilePath);
    &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; StreamWriter(fs).WriteLine(file.FileContents);
    fs.Close();
    &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; tempFilePath;
}&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;strong&gt;&lt;u&gt;Clearing temp&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
If you respect the word TEMP ,there is no need to worry about clearing the temp folder because that is temporary and users or admins are allowed or trained to clean that folder whenever they need more hard disk space . If you agree with me go ahead and concentrate on your application and leave the temp to users. Else ie if you are particular about cleaning temp follow the below link which employees a file watcher to clean the temp immediately after the file is dropped.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.codeproject.com/Articles/23207/Drag-and-Drop-to-Windows-Folder-C&quot;&gt;http://www.codeproject.com/Articles/23207/Drag-and-Drop-to-Windows-Folder-C&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Sample&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Download the sample from &lt;a href=&quot;https://www.dropbox.com/s/xx73k7ek9qsvge9/DragDrop2Desktop.zip&quot;&gt;this link&lt;/a&gt;&lt;/div&gt;</description><link>http://joyfulwpf.blogspot.com/2012/06/drag-and-drop-files-from-wpf-to-desktop.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8422996711799977570.post-2993586555890732841</guid><pubDate>Thu, 23 Feb 2012 18:46:00 +0000</pubDate><atom:updated>2012-02-24T00:38:03.000+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.Net 4</category><category domain="http://www.blogger.com/atom/ns#">Application Architecture</category><category domain="http://www.blogger.com/atom/ns#">MVVM</category><category domain="http://www.blogger.com/atom/ns#">WPF</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><title>MVVm - Embed C# code in XAML like ASP.Net MVC</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It is long time since I posted something in this blog. I know this is my most famous blog with average 200hits/day but I was mainly concentrating into the other aspects of .Net such as CLR,&amp;nbsp;WCF, ASP.Net, Windows Phone 7 etc than this XAML based display technology. There are 2 main inspirations for this post.&lt;br /&gt;
&lt;br /&gt;
First one is a comment which I got on my post related to &lt;a href=&quot;http://joyfulwpf.blogspot.in/2009/05/understanding-opacitymask-and-its-usage.html&quot;&gt;opacitymask and its usage&lt;/a&gt; in WPF. The&amp;nbsp;specialty&amp;nbsp;of that is, it came from a MSFT guy. I don&#39;t know how others are thinking, but for me its little important. Even I am not sure whether that MSFT is just something else or that person just added MSFT :-)&lt;br /&gt;
&lt;br /&gt;
The second reason is &quot;This is my 100th post on WPF technology and I want that to be something special and useful&quot;. I was in search for such a topic and just found today, while I was working with &lt;a href=&quot;http://www.asp.net/mvc&quot;&gt;ASP.Net MVC&lt;/a&gt; 3 application.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;The problem&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Anyway I am not wasting time on introduction.Lets come to the topic. As everybody knows MVVm is the widely&amp;nbsp;accepted pattern for the XAML based technologies such as WPF and Silverlight. The main reason I could see is the data binding support. By design the pattern is not expecting anything in the code behind and everything related to business should reside in the viewmodel. Its all fine.We can have data binding and commands to separate the view from vm. But what can I do with the dialogs? Since they are UI is that desirable to call showdialog from viewmodel or should I write code behind for views and pass the dialog result to vm through event aggregator or any other messaging mechanism? Mainly this comes into picture when we need to browse for a file or show a messagebox in MVVm based application.&lt;br /&gt;
&lt;br /&gt;
There are something called behaviors and &lt;a href=&quot;http://joyfulwpf.blogspot.in/2009/05/writing-custom-triggeraction-using.html&quot;&gt;triggers &lt;/a&gt;in an expression blend dll named &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.interactivity(v=expression.40).aspx&quot;&gt;System.windows.interactivity&lt;/a&gt; which we can leverage to accomplish the same. But are there any better way? Yes another way is to call the ShowDialog from the vm itself and process it. This is what I was following till I came to play more with &lt;a href=&quot;http://www.asp.net/mvc/overview/getting-started&quot;&gt;ASP.Net MVC pattern.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;What is special with ASP.Net MVC&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
MVC is another UI pattern to separate the UI from its business. When Microsoft implemented a framework to write asp.net applications using the same, people started calling it as ASP.Net MVC. Actually there is no relation between ASP.Net and MVC .Anybody can implement MVC in their application without MSFT framework.&lt;br /&gt;
&lt;br /&gt;
The specialty I noticed in MVC framework is, there is no option to write code behind. In the &lt;a href=&quot;http://msdn.microsoft.com/en-us/gg618477&quot;&gt;RAZOR &lt;/a&gt;view we cannot even find a code behind file. I wondered how people are accomplishing their tasks without writing the code behind for views. Theoretically we can say &quot;don&#39;t write code behind&quot; .But I have never seen a big enterprise application in MVVm without code behind for at least one view.Coming back to ASP.Net MVC, the RAZOR don&#39;t give us option to write code behind but provides support to embed code inside the view itself.&lt;br /&gt;
Yes the idea flashed in my head and I could recollect one of my old post which explains &lt;a href=&quot;http://joyfulwpf.blogspot.in/2007/05/writing-c-inside-xaml.html&quot;&gt;embedding code &amp;nbsp; &amp;nbsp;inside the xaml file&lt;/a&gt;&amp;nbsp;.That is the way to handle the dialog boxes better.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Solution : Embed C# or VB.Net code in xaml view&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
This doesn&#39;t mean we should move the code behind file into the view. This helps to write the dialog handling code in the view itself. Below is one example of such an implementation.&lt;br /&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, &quot;Courier New&quot;, Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot;&gt;    &amp;lt;Grid&amp;gt;
        &amp;lt;Grid.ColumnDefinitions&amp;gt;
            &amp;lt;ColumnDefinition Width=&lt;span class=&quot;str&quot;&gt;&quot;*&quot;&lt;/span&gt; /&amp;gt;
            &amp;lt;ColumnDefinition Width=&lt;span class=&quot;str&quot;&gt;&quot;Auto&quot;&lt;/span&gt; /&amp;gt;
            &amp;lt;ColumnDefinition Width=&lt;span class=&quot;str&quot;&gt;&quot;Auto&quot;&lt;/span&gt; /&amp;gt;
        &amp;lt;/Grid.ColumnDefinitions&amp;gt;
        &amp;lt;TextBox x:Name=&lt;span class=&quot;str&quot;&gt;&quot;txtFileName&quot;&lt;/span&gt;
                 Text=&lt;span class=&quot;str&quot;&gt;&quot;{Binding FilePath,UpdateSourceTrigger=PropertyChanged}&quot;&lt;/span&gt; /&amp;gt;
        &amp;lt;Button Grid.Column=&lt;span class=&quot;str&quot;&gt;&quot;1&quot;&lt;/span&gt; Content=&lt;span class=&quot;str&quot;&gt;&quot;Browse&quot;&lt;/span&gt; Click=&lt;span class=&quot;str&quot;&gt;&quot;Clicked&quot;&lt;/span&gt; /&amp;gt;
        &amp;lt;x:Code&amp;gt;
            &amp;lt;![CDATA[
&lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Clicked(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
{
            Microsoft.Win32.OpenFileDialog ofd = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Microsoft.Win32.OpenFileDialog();
            ofd.DefaultExt = &lt;span class=&quot;str&quot;&gt;&quot;.exe&quot;&lt;/span&gt;;
            ofd.Filter = &lt;span class=&quot;str&quot;&gt;&quot;Executables (.exe)|*.exe&quot;&lt;/span&gt;; &lt;span class=&quot;rem&quot;&gt;// Filter files by extension&lt;/span&gt;

            &lt;span class=&quot;rem&quot;&gt;// Show open file dialog box&lt;/span&gt;
            Nullable&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt;&amp;gt; result = ofd.ShowDialog();
            &lt;span class=&quot;rem&quot;&gt;// Process open file dialog box results&lt;/span&gt;
            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (result.HasValue &amp;amp;&amp;amp; result.Value)
            {
                &lt;span class=&quot;rem&quot;&gt;// Set value to textbox which will update the property of VM&lt;/span&gt;
                txtFileName.Text= ofd.FileName;
            }
}
]]&amp;gt;
        &amp;lt;/x:Code&amp;gt;
        &amp;lt;Button Content=&lt;span class=&quot;str&quot;&gt;&quot;Start&quot;&lt;/span&gt;
                Grid.Column=&lt;span class=&quot;str&quot;&gt;&quot;2&quot;&lt;/span&gt;
                Command=&lt;span class=&quot;str&quot;&gt;&quot;{Binding StartCommand}&quot;&lt;/span&gt; /&amp;gt;
    &amp;lt;/Grid&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Pros and Cons&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
One thing to notice is that we need to give name to the controls which other developers may use to write code behind.Next thing how to show a message dialog box in this way .For that we need to keep a property in the vm and bind to a hidden textbox . Wire the TextChanged event of textbox to an event handler in the view as how the above C# code is written .&lt;br /&gt;
Main development challenge will be how to write code without intellisense .Yes you don&#39;t get intellisense when writing code inside xaml file.One way to overcome is to write the code in normal file and copy paste.&lt;/div&gt;
</description><link>http://joyfulwpf.blogspot.com/2012/02/mvvm-embed-c-code-in-xaml-like-aspnet.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>6</thr:total></item><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=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb613588(v=vs.110).aspx&quot;&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&#39;t find much interesting features.&lt;/div&gt;
</description><link>http://joyfulwpf.blogspot.com/2011/09/wpf-45-new-features.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>1</thr:total></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#">Controls</category><category domain="http://www.blogger.com/atom/ns#">Dependency Property</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</category><title>How dependency property internally works? A MUST read for WPF and Silverlight developers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&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=&quot;http://www.abhisheksur.com/2011/07/internals-of-dependency-property-in-wpf.html&quot;&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;
</description><link>http://joyfulwpf.blogspot.com/2011/08/how-dependency-property-internally.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Databinding</category><category domain="http://www.blogger.com/atom/ns#">Debugging</category><category domain="http://www.blogger.com/atom/ns#">Style</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=&quot;http://blois.us/Snoop/&quot;&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=&quot;http://wpfinspector.codeplex.com&quot; href=&quot;http://wpfinspector.codeplex.com&quot;&gt;http://wpfinspector.codeplex.com&lt;/a&gt;&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2011/03/open-source-wpfinspector.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>1</thr:total></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#">Application Architecture</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">WPF Training</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=&quot;http://en.wikipedia.org/wiki/Windows_Presentation_Foundation&quot;&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;  </description><link>http://joyfulwpf.blogspot.com/2010/12/technology-vs-concepts-and-architecture.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Common Code Base</category><category domain="http://www.blogger.com/atom/ns#">Controls</category><category domain="http://www.blogger.com/atom/ns#">XAML</category><category domain="http://www.blogger.com/atom/ns#">XAML 2009</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=&quot;#ff0000&quot;&gt;The tag &#39;TreeView&#39; does not exist in XML namespace &#39;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#39;.&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=&quot;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&quot;&gt;   &lt;pre style=&quot;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&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Class&lt;/span&gt; CCBTreeView&lt;br /&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;Inherits&lt;/span&gt; System.Windows.Controls.TreeView&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&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=&quot;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&quot;&gt;&lt;br /&gt;  &lt;pre style=&quot;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&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;UserControl&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Class&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;TestCompatibility.MyControl&amp;quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:x&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;br /&gt;             &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:CCBControls&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;clr-namespace:CCB.Controls;assembly=CCB.Controls&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CCBControls:CCBTreeView&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;ItemsSource&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;{Binding Persons}&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;UserControl&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&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=&quot;http://cid-890c06c8106550a0.office.live.com/self.aspx/BlogSamples/JoyfulWPF/CCB%5E_Controls.zip&quot;&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=&quot;http://joyfulwpf.blogspot.com/2010/06/common-code-base-1-introduction.html&quot;&gt;Common Code Base 1 Introduction&lt;/a&gt;&lt;br /&gt;  &lt;br /&gt;&lt;a href=&quot;http://joyfulwpf.blogspot.com/2010/07/common-code-base-2-styles-and-templates.html&quot;&gt;Common Code Base 2 Styles and Templates&lt;/a&gt;&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2010/08/common-code-base-3-handling-controls.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Databinding</category><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#">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=&quot;http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx&quot; href=&quot;http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/debugging-data-bindings-in-a-wpf-or-silverlight-application.aspx&quot;&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;  </description><link>http://joyfulwpf.blogspot.com/2010/08/debugging-wpf-and-silverlight.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Common Code Base</category><category domain="http://www.blogger.com/atom/ns#">Style</category><category domain="http://www.blogger.com/atom/ns#">Template</category><category domain="http://www.blogger.com/atom/ns#">Triggers</category><category domain="http://www.blogger.com/atom/ns#">XAML</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=&quot;http://msdn.microsoft.com/en-us/library/system.windows.trigger.aspx&quot;&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=&quot;http://cid-890c06c8106550a0.office.live.com/self.aspx/BlogSamples/JoyfulWPF/CCB%5E_Test%5E_Styles.zip&quot;&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=&quot;http://joyfulwpf.blogspot.com/2010/06/common-code-base-1-introduction.html&quot;&gt;Common Code Base 1 Introduction&lt;/a&gt;&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2010/07/common-code-base-2-styles-and-templates.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>1</thr:total></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>2014-09-16T07:56:55.582+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;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
One of my &lt;a href=&quot;http://silverlightedweb.blogspot.com/&quot;&gt;Silverlight blog&lt;/a&gt; post is about &lt;a href=&quot;http://silverlightedweb.blogspot.com/2010/03/creating-wcf-proxy-without-reference.html&quot;&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;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&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=&quot;http://msdn.microsoft.com/en-us/library/aa347733.aspx&quot;&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;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&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=&quot;http://lh3.ggpht.com/_jIJDXxbTxiU/TBR_s0U_umI/AAAAAAAAAME/QczaUB4h8yY/s512/ManualProxy.jpg&quot; /&gt; &lt;/div&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=&quot;http://msdn.microsoft.com/en-us/library/ms576141.aspx&quot;&gt;ClientBase&lt;/a&gt; with a generic class.It will be clear after seeing the code below.&lt;br /&gt;
&lt;div style=&quot;background-color: #f4f4f4; border-bottom: gray 1px solid; border-left: gray 1px solid; border-right: gray 1px solid; border-top: gray 1px solid; cursor: text; font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; width: 97.5%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; font-family: consolas, &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Imports&lt;/span&gt; System.ServiceModel
&lt;span style=&quot;color: blue;&quot;&gt;Imports&lt;/span&gt; ManualProxyTest.Core
&lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Class&lt;/span&gt; ServiceProxy
    &lt;span style=&quot;color: blue;&quot;&gt;Inherits&lt;/span&gt; ClientBase(Of IMyService)
    &lt;span style=&quot;color: blue;&quot;&gt;Implements&lt;/span&gt; IMyService
    &lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt; GetData(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; value &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Implements&lt;/span&gt; IMyService.GetData
        &lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Me&lt;/span&gt;.Channel.GetData(value)
    &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;
    &lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt; Divide(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; no1 &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; no2 &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Double&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Implements&lt;/span&gt; IMyService.Divide
        &lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Me&lt;/span&gt;.Channel.Divide(no1, no2)
    &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;
    &lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt; GetChar(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; data &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; position &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Integer&lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Char&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Implements&lt;/span&gt; IMyService.GetChar
        &lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Me&lt;/span&gt;.Channel.GetChar(data, position)
    &lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; Class&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&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;br /&gt;
&lt;iframe frameborder=&quot;0&quot; height=&quot;120&quot; scrolling=&quot;no&quot; src=&quot;https://onedrive.live.com/embed?cid=890C06C8106550A0&amp;amp;resid=890C06C8106550A0%21187&amp;amp;authkey=AHoknES0qHhsae4&quot; width=&quot;98&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
</description><link>http://joyfulwpf.blogspot.com/2010/06/calling-wcf-service-without.html</link><author>noreply@blogger.com (Joymon)</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></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=&quot;http://lh5.ggpht.com/_jIJDXxbTxiU/TBNW27li_7I/AAAAAAAAAMA/N8CzyuF3eqI/s512/CCB_1_1.jpg&quot; /&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;  </description><link>http://joyfulwpf.blogspot.com/2010/06/common-code-base-1-introduction.html</link><author>noreply@blogger.com (Joymon)</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></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#">.Net 3.5</category><category domain="http://www.blogger.com/atom/ns#">Bug</category><category domain="http://www.blogger.com/atom/ns#">DataTemplate</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=&quot;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&quot;&gt;   &lt;pre style=&quot;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&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&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=&quot;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&quot;&gt;&lt;br /&gt;  &lt;pre style=&quot;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&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ListBox&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;lstPersons&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;local:MyDataTemplate&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Button&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;{Binding Name}&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;local:MyDataTemplate&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ListBox&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&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&#39; object cannot be added to &#39;MyDataTemplate&#39;. Object of type &#39;System.Windows.Controls.StackPanel&#39; cannot be converted to type &#39;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;  </description><link>http://joyfulwpf.blogspot.com/2010/06/wpf-35-bug-in-inheriting-datatemplate.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Controls</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">WPF</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=&quot;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&quot;&gt;   &lt;pre style=&quot;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&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Dim&lt;/span&gt; lbi &lt;span style=&quot;color: #0000ff&quot;&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;  </description><link>http://joyfulwpf.blogspot.com/2010/04/getting-listboxitem-from-selected.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Controls</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><category domain="http://www.blogger.com/atom/ns#">WPF</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=&quot;http://msdn.microsoft.com/en-us/library/system.windows.controls.progressbar.aspx&quot;&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=&quot;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&quot;&gt;   &lt;pre style=&quot;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&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Sub&lt;/span&gt; btn_Click(&lt;span style=&quot;color: #0000ff&quot;&gt;ByVal&lt;/span&gt; sender &lt;span style=&quot;color: #0000ff&quot;&gt;As&lt;/span&gt; System.&lt;span style=&quot;color: #0000ff&quot;&gt;Object&lt;/span&gt;, &lt;span style=&quot;color: #0000ff&quot;&gt;ByVal&lt;/span&gt; e &lt;span style=&quot;color: #0000ff&quot;&gt;As&lt;/span&gt; System.Windows.RoutedEventArgs)&lt;br /&gt;    IncrementContinuously()&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Sub&lt;/span&gt; IncrementContinuously()&lt;br /&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;For&lt;/span&gt; i = 0 &lt;span style=&quot;color: #0000ff&quot;&gt;To&lt;/span&gt; 50&lt;br /&gt;        Thread.Sleep(100)&lt;br /&gt;        prgs.Dispatcher.Invoke(&lt;span style=&quot;color: #0000ff&quot;&gt;New&lt;/span&gt; CrossAppDomainDelegate(&lt;span style=&quot;color: #0000ff&quot;&gt;AddressOf&lt;/span&gt; IncrementBy1), DispatcherPriority.Background, &lt;span style=&quot;color: #0000ff&quot;&gt;Nothing&lt;/span&gt;)&lt;br /&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;Next&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Sub&lt;/span&gt; IncrementBy1()&lt;br /&gt;    prgs.Value = prgs.Value + 1&lt;br /&gt;&lt;span style=&quot;color: #0000ff&quot;&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=&quot;http://stackoverflow.com/questions/1194620/c-newbie-show-progress-during-a-loop-wpf&quot;&gt;link&lt;/a&gt; contains some more solutions.&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2010/04/why-wpf-progressbar-is-not-updating.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>1</thr:total></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#">MCTS</category><category domain="http://www.blogger.com/atom/ns#">WPF</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;  </description><link>http://joyfulwpf.blogspot.com/2010/03/mcts-in-wpf.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>3</thr:total></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#">INotifyPropertyChanged</category><category domain="http://www.blogger.com/atom/ns#">Lambda Expressions</category><category domain="http://www.blogger.com/atom/ns#">MVVM</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=&quot;http://mfelicio.wordpress.com/2010/01/10/safe-usage-of-inotifypropertychanged-in-mvvm-scenarios/&quot; href=&quot;http://mfelicio.wordpress.com/2010/01/10/safe-usage-of-inotifypropertychanged-in-mvvm-scenarios/&quot;&gt;http://mfelicio.wordpress.com/2010/01/10/safe-usage-of-inotifypropertychanged-in-mvvm-scenarios/&lt;/a&gt;&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2010/02/type-safe-inotifypropertychanged.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>1</thr:total></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=&quot;http://blogs.msdn.com/llobo/archive/2009/11/25/concluding-new-wpf-features-series.aspx&quot;&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=&quot;http://blogs.msdn.com/llobo/archive/2009/11/19/xaml-2009-features-generics-support.aspx&quot;&gt;http://blogs.msdn.com/llobo/archive/2009/11/19/xaml-2009-features-generics-support.aspx&lt;/a&gt;&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2009/12/new-wpf-and-xaml-features.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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#">Lambda Expressions</category><category domain="http://www.blogger.com/atom/ns#">Markup extension</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=&quot;http://www.fikrimvar.net/lestirelim/?p=15&quot;&gt;WPFix Part 1&lt;/a&gt;  &lt;li&gt;&lt;a href=&quot;http://www.fikrimvar.net/lestirelim/?p=18&quot;&gt;WPFix Part 2 (Binding Extension)&lt;/a&gt;  &lt;li&gt;&lt;a href=&quot;http://www.fikrimvar.net/lestirelim/?p=23&quot;&gt;WPFix Part 3 (Extension Methods)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Thanks to &lt;a href=&quot;http://www.fikrimvar.net/lestirelim/&quot;&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&#39;t support custom mark-up extensions.&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2009/10/using-lambda-expression-in-xaml.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>0</thr:total></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=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnVxhoM1Kn4vHaUthrhBnbQrDzokNBWK711ply_voiPd9MIc8EUqXwM2J3trf6vP53H7zUAnUsDZzgDE97dJxrovi3Li_YV_2AhlY8jTBGbWfKkN8cYE6gupZZc2QV6-EYyS0pmrQ-s90E/&quot; width=&quot;640&quot; height=&quot;371&quot;&gt; &lt;/p&gt;Set it as XAML coding practice and do a smooth code review...  </description><link>http://joyfulwpf.blogspot.com/2009/09/auto-formatting-xaml-code.html</link><author>noreply@blogger.com (Joymon)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnVxhoM1Kn4vHaUthrhBnbQrDzokNBWK711ply_voiPd9MIc8EUqXwM2J3trf6vP53H7zUAnUsDZzgDE97dJxrovi3Li_YV_2AhlY8jTBGbWfKkN8cYE6gupZZc2QV6-EYyS0pmrQ-s90E/s72-c" height="72" width="72"/><thr:total>0</thr:total></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=&quot;justify&quot;&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=&quot;justify&quot;&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=&quot;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, &#39;Courier New&#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&quot;&gt; &lt;div style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Class&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Window1&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:x&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:sys&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;clr-namespace:System;assembly=mscorlib&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;Title&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Window1&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window.Resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:Byte&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;day&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;18&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:Byte&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:String&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;month&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Apr&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:String&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:Int32&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;year&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;1984&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:Int32&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;TextBlock&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;monthtxt&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;                   &lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource month}&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:Double&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;fontsize&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;14&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:Double&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window.Resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Orientation&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Horizontal&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;TextBlock&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;FontSize&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource fontsize}&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;                   &lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;My DOB :&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ContentControl&lt;/span&gt;  &lt;span style=&quot;color: #ff0000&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource day}&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ContentControl&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource monthtxt}&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ContentControl&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource year}&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&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=&quot;justify&quot;&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=&quot;http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.aspx&quot;&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=&quot;http://msdn.microsoft.com/en-us/library/ms747254.aspx&quot;&gt;mark-up extension&lt;/a&gt; and other through code.The above code shows how to retrieve through the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms750950.aspx&quot;&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=&quot;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, &#39;Courier New&#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&quot;&gt;&lt;br /&gt;&lt;div style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Class&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Window1&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:x&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:sys&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;clr-namespace:System;assembly=mscorlib&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window.Resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:String&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;fullname&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Joy George K&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;sys:String&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;TextBlock&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;nametxt&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;                   &lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource fullname}&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window.Resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Orientation&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Horizontal&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;TextBlock&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;FullName :&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StaticResource&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;ResourceKey&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;nametxt&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&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=&quot;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, &#39;Courier New&#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&quot;&gt;&lt;br /&gt;&lt;div style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;Dim&lt;/span&gt; fullname &lt;span style=&quot;color: #0000ff&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #0000ff&quot;&gt;Me&lt;/span&gt;.FindResource(&lt;span style=&quot;color: #006080&quot;&gt;&quot;fullname&quot;&lt;/span&gt;)&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;If&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Not&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;String&lt;/span&gt;.IsNullOrEmpty(fullname) &lt;span style=&quot;color: #0000ff&quot;&gt;Then&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    MessageBox.Show(&lt;span style=&quot;color: #006080&quot;&gt;&quot;My FullName :&quot;&lt;/span&gt; &amp;amp; fullname)&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&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=&quot;http://msdn.microsoft.com/en-us/library/aa350178.aspx&quot;&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=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg66RSr4MA5QeBs2dGjpSWXfw3skiaNeo5hjhu8EwjXNMXg27FwtprXuD1ulCbFge1ctcXt5T8MLPbDkiQUGfY1ABJVKSuR-W9c3ruXog7EA9CQPAUAf3AnlAnAYhPKfHg643HXYiA_GClw/&quot;&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=&quot;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, &#39;Courier New&#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&quot;&gt;&lt;br /&gt;&lt;div style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;x:Class&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Window1&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:x&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;xmlns:sys&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;clr-namespace:System;assembly=mscorlib&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window.Resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ResourceDictionary&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ResourceDictionary&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Source&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;brushes.xaml&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ResourceDictionary.MergedDictionaries&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ResourceDictionary&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window.Resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Orientation&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;Horizontal&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;TextBlock&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;FullName : Joy George K&quot;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;                   &lt;span style=&quot;color: #ff0000&quot;&gt;Background&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;{StaticResource background}&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;StackPanel&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;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, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;Window&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&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=&quot;justify&quot;&gt;Refer this &lt;a href=&quot;http://cid-890c06c8106550a0.skydrive.live.com/self.aspx/BlogSamples/JoyfulWPF/ResourceDictionary.zip&quot;&gt;sample&lt;/a&gt; if you are still in confusion.&lt;/p&gt;  </description><link>http://joyfulwpf.blogspot.com/2009/09/understanding-wpf-resourcedictionary.html</link><author>noreply@blogger.com (Joymon)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg66RSr4MA5QeBs2dGjpSWXfw3skiaNeo5hjhu8EwjXNMXg27FwtprXuD1ulCbFge1ctcXt5T8MLPbDkiQUGfY1ABJVKSuR-W9c3ruXog7EA9CQPAUAf3AnlAnAYhPKfHg643HXYiA_GClw/s72-c" height="72" width="72"/><thr:total>6</thr:total></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=&quot;http://jimmangaly.blogspot.com/&quot;&gt;Jim Mangaly&lt;/a&gt; giving nice presentations and trainings, when I was working in &lt;a href=&quot;http://www.identitymine.com/&quot;&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&#39;t stop it&#39;s rotations.It became weeks,weeks became months and months became years.After 2 years I joined in &lt;a href=&quot;http://www.orioninc.com/&quot;&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 &quot;How to present the new features in WPF ?&quot; 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&#39;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&#39;s &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint.aspx&quot;&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 &#39;Job&#39;.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 &quot;XAML&quot;,&quot;Template&quot;,&quot;Transform&quot;,&quot;Styles&quot; 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...</description><link>http://joyfulwpf.blogspot.com/2009/08/wpf-training-at-orion.html</link><author>noreply@blogger.com (Joymon)</author><thr:total>1</thr:total></item></channel></rss>