<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Alex Sarafian as Developer &#187; WPF</title>
	<atom:link href="http://sarafianalex.wordpress.com/category/net-c/wpf-net-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://sarafianalex.wordpress.com</link>
	<description>Adventures in C# Land and some SQL</description>
	<lastBuildDate>Fri, 04 Sep 2009 11:27:50 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='sarafianalex.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/ea38bb69738d229a89ab00b82aad64b7?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Alex Sarafian as Developer &#187; WPF</title>
		<link>http://sarafianalex.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sarafianalex.wordpress.com/osd.xml" title="Alex Sarafian as Developer" />
		<item>
		<title>XCEED Datagrid</title>
		<link>http://sarafianalex.wordpress.com/2009/06/02/xceed-datagrid/</link>
		<comments>http://sarafianalex.wordpress.com/2009/06/02/xceed-datagrid/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 12:14:05 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[.NET C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2009/06/02/xceed-datagrid/</guid>
		<description><![CDATA[ is changing licensing for the express edition. I’ve been using XCEED’s datagrid control for WPF for a year now, because it was the best grid control I could find, and for some of the controls for Date Time and numeric included in the library.
XCEED is changing licensing for the express edition and&#160; has launched [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=67&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="justify"> is changing licensing for the express edition. I’ve been using XCEED’s datagrid control for WPF for a year now, because it was the best grid control I could find, and for some of the controls for Date Time and numeric included in the library.</p>
<p align="justify"><a href="http://xceed.com/">XCEED</a> is changing licensing for the express edition and&#160; has launched a campain in order to notify everyone interested in the express edition and still wants to have the benefits he had before the change.</p>
<p align="justify">So just visit <a href="http://xceed.com/freegrid">http://xceed.com/freegrid</a> and update your license.</p>
Posted in .NET C#, WPF  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=67&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2009/06/02/xceed-datagrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable / Disable Binding Validation</title>
		<link>http://sarafianalex.wordpress.com/2009/02/20/enable-disable-binding-validation/</link>
		<comments>http://sarafianalex.wordpress.com/2009/02/20/enable-disable-binding-validation/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 13:24:18 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[.NET C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2009/02/20/enable-disable-binding-validation/</guid>
		<description><![CDATA[Today a came across a situation where I need to stop a binding from validating through the validation rules.
There is no easy way to do this. One should think that you can change the hole binding etc etc.
After doing a little snipping while in debug, I saw that the BindingExpression return from BindingExpression GetBindingExpression(DependencyPropertydp) holds [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=64&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="justify">Today a came across a situation where I need to stop a binding from validating through the validation rules.</p>
<p align="justify">There is no easy way to do this. One should think that you can change the hole binding etc etc.</p>
<p align="justify">After doing a little snipping while in debug, I saw that the <span style="color:#2b91af;">BindingExpression </span>return from <span style="color:#2b91af;">BindingExpression </span>GetBindingExpression(<span style="color:#2b91af;">DependencyProperty</span>dp) holds in the ParentBinding.ValidationRules the validation rules declared in xaml or not.</p>
<p align="justify">So I decided to create a <span style="color:#2b91af;">BaseValidationRule </span>from which all validation rules will subclass.</p>
<p align="justify"><span style="color:blue;">public abstract class</span><span style="color:#2b91af;">BaseValidationRule</span>:<span style="color:#2b91af;">ValidationRule     <br />&#160;&#160; </span>{    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">protected </span>BaseValidationRule()    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IsActive = <span style="color:blue;">true</span>;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public bool </span>IsActive { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }    </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">protected abstract </span><span style="color:#2b91af;">ValidationResult </span>DoValidate(<span style="color:blue;">object</span>value,    <br /> System.Globalization.<span style="color:#2b91af;">CultureInfo</span>cultureInfo);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public override</span><span style="color:#2b91af;">ValidationResult </span>Validate(<span style="color:blue;">object</span>value,     <br />System.Globalization.<span style="color:#2b91af;">CultureInfo </span>cultureInfo)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">if</span>(!IsActive)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">return</span><span style="color:#2b91af;">ValidationResult</span>.ValidResult;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">return </span>DoValidate(value, cultureInfo);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }    <br />&#160;&#160;&#160; }</p>
<p align="justify">&#160;</p>
<p align="justify">As you can see if the rule is not active then it will simply return a <span style="color:#2b91af;">ValidationResult</span>.ValidResult so everything will be as though as you didn’t have validation rules in xaml.</p>
<p align="justify">I created some extention methods in order to quickly and transparently enable or disable validation rules at will.</p>
<p align="justify">Note that in order for the binding to be reevaluated based on the new status of your validation rules, you need to call UpdateSource on you <span style="color:#2b91af;">BindingExpression </span>.</p>
Posted in .NET C#, WPF  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=64&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2009/02/20/enable-disable-binding-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF vs Windows Forms</title>
		<link>http://sarafianalex.wordpress.com/2008/11/25/wpf-vs-windows-forms/</link>
		<comments>http://sarafianalex.wordpress.com/2008/11/25/wpf-vs-windows-forms/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 21:43:14 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2008/11/25/wpf-vs-windows-forms/</guid>
		<description><![CDATA[Today I was at a DevDay in Athens, Greece with subject the 3 W of .NET 3 and 3.5. WPF, WCF and WWF.
First of all, I want to say that for one for time, it was just like reading glorious posts on the net about how easy stuff are with Microsoft technologies. Guys, business applications [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=45&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="justify">Today I was at a DevDay in Athens, Greece with subject the 3 W of .NET 3 and 3.5. WPF, WCF and WWF.</p>
<p align="justify">First of all, I want to say that for one for time, it was just like reading glorious posts on the net about how easy stuff are with Microsoft technologies. Guys, business applications are not a paper for a university lesson. Programmers in companies should not be carried away by tricks that show of, but not give a resolve issues that enterprise developers must solve.</p>
<p align="justify">Based on that, once again WCF was great. Hell its not because of reasons discussed&nbsp; <a href="http://sarafianalex.wordpress.com/2008/06/17/wcf-debuging/">here</a> and <a href="http://sarafianalex.wordpress.com/2008/06/28/how-to-debug-a-wcf-service/">here</a>. In the WWF, a colleague of mine asked a very logical question, but there was no answer either. I don&#8217;t know whether those presenting the technologies don&#8217;t have a deep understanding of the technologies discussed or they purpose is to market them.</p>
<p align="justify">In the subject that I understand best, that is WPF, I really must say that based on what was presented, no one would migrate to the technology. The speaker made the usual mistake of basing his presentation on the usual wrong stuff, Graphic, Animation Fantastic UI and the so called developer &#8211; designer better cooperation. But when a member of the audience asked the logical question, of why should I migrate,&nbsp; when all there are so huge differences and especially when a dedicated designer will be required still there was no clear answer to point out that true power of WPF.</p>
<p align="justify">So I will try to point out what are the overwhelming advantages of WPF and also point out some of the wrongs that I have found in the last six months.</p>
<p align="justify">Yes there is a tough learning curve, but the true power of WPF resides in the data binding mechanism and the way it shares resources across the application. On extra benefit that comes from the learning curve is that who learn how to decouple logic from UI. It&#8217;s not because of a pattern, but because of the data binding mechanism. Truly an application will last longer, when the UI can be changed without producing problems to the logic. Use the templates right and you can change a piece of UI code that reflects to the entire application. And don&#8217;t get me started about the usage of Control Templates.</p>
<p align="justify">Routed events are also great but the resource sharing is awesome. Just create a themed application in windows forms and compare the memory used by heavy brushes with a WPF themed application.</p>
<p align="justify">All the above comes with greatly improved performance, bonus from .NET 3.5 SP1.</p>
<p align="justify">My first problem with WPF and with Microsoft is the total disregard for Datasets and especially typed datasets. WPF will be on a client which if it is an enterprise application, it will require an application server. What better way to have related data transferred over the wire than from dataset? This is why I say that Microsoft has great ideas, but tends to forget the real needs of business. All examples are with simple objects which have set and get methods. But that is the simple way. That would be the solution for a university exercise because in real world you cant hit the application server continually, wcf or not.</p>
<p align="justify">Second problem with WPF is the Command mechanism that is used. Don&#8217;t get me wrong, the idea is great but why it must be static the Command instance? If I want to create the same form twice as non modal window, what will happen? It is not clear to me why they have chosen static for commands.</p>
<p align="justify">For the last six months I&#8217;ve been developing with colleagues a WPF application that can handle several modules not known at design time, and all these modules and the shell can must present themselves in various languages based on the installation. I really don&#8217;t know how some things could have been made with windows forms.</p>
<p align="justify">For me WPF and WCF are the most powerful add-ons in the .NET3 version and older. I just wish Microsoft would be a little more serious about the needs of true enterprise applications and not just glowingly showing little demos.</p>
Posted in WPF  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=45&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2008/11/25/wpf-vs-windows-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Themes</title>
		<link>http://sarafianalex.wordpress.com/2008/11/19/wpf-themes/</link>
		<comments>http://sarafianalex.wordpress.com/2008/11/19/wpf-themes/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 07:45:11 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2008/11/19/wpf-themes/</guid>
		<description><![CDATA[I knew for a time that Visual State Manager from Silverlight had been ported for WPF, via the WPF.Toolkit project.
Today I found out that there some interesting themes based on the Visual State Manager.
Here is the post
I especially like DavesGlossyControls

Posted in WPF       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=43&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I knew for a time that Visual State Manager from Silverlight had been ported for WPF, via the <a href="http://www.codeplex.com/wpf">WPF.Toolkit</a> project.</p>
<p>Today I found out that there some interesting themes based on the Visual State Manager.</p>
<p>Here is the <a href="http://dotnet.org.za/rudi/archive/2008/11/06/wpf-themes-released.aspx">post</a></p>
<p>I especially like DavesGlossyControls</p>
<p><img src="http://dotnet.org.za/blogs/rudi/themes/DavesGlossyControls.jpg"></p>
Posted in WPF  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=43&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2008/11/19/wpf-themes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>

		<media:content url="http://dotnet.org.za/blogs/rudi/themes/DavesGlossyControls.jpg" medium="image" />
	</item>
		<item>
		<title>WPF ShowDialog</title>
		<link>http://sarafianalex.wordpress.com/2008/09/12/wpf-showdialog/</link>
		<comments>http://sarafianalex.wordpress.com/2008/09/12/wpf-showdialog/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 08:26:49 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[.NET C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2008/09/12/wpf-showdialog/</guid>
		<description><![CDATA[There is an issue with ShowDialog for Windows not always obeying Modal Dialogs rules.
So I have created a static class which all ShowDialog calls will be redirected.
public static bool ShowDialog(Window dialog,Window owner)
{
    if (owner != null)
    {
        WindowInteropHelper helper = new WindowInteropHelper(dialog);
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=40&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There is an issue with ShowDialog for Windows not always obeying Modal Dialogs rules.</p>
<p>So I have created a static class which all ShowDialog calls will be redirected.</p>
<blockquote><pre class="code"><span style="color:blue;">public static bool </span>ShowDialog(<span style="color:#2b91af;">Window </span>dialog,<span style="color:#2b91af;">Window </span>owner)
{
    <span style="color:blue;">if </span>(owner != <span style="color:blue;">null</span>)
    {
        <span style="color:#2b91af;">WindowInteropHelper </span>helper = <span style="color:blue;">new </span><span style="color:#2b91af;">WindowInteropHelper</span>(dialog);
        helper.Owner = <span style="color:blue;">new </span><span style="color:#2b91af;">WindowInteropHelper</span>(owner).Handle;
    }
    <span style="color:blue;">bool</span>? dialogResult = dialog.ShowDialog();
    <span style="color:blue;">return </span>dialogResult.HasValue ? dialogResult.Value : <span style="color:blue;">false</span>;
}</pre>
</blockquote>
<p>&nbsp;</p>
<p>I&#8217;ve made some corrections so this is the new code</p>
<p><span style="color:blue;">public static bool </span>ShowDialog(<span style="color:#2b91af;">Window</span>dialog, <span style="color:#2b91af;">Window</span>owner)<br />{<br />&nbsp;&nbsp; <span style="color:#2b91af;">WindowInteropHelper </span>helper = <span style="color:blue;">new</span><span style="color:#2b91af;">WindowInteropHelper</span>(dialog);<br />&nbsp;&nbsp; <span style="color:blue;">if</span>(owner != <span style="color:blue;">null</span>)<br />&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; helper.Owner = <span style="color:blue;">new</span><span style="color:#2b91af;">WindowInteropHelper</span>(owner).Handle;<br />&nbsp;&nbsp; }<br />&nbsp;&nbsp; <span style="color:blue;">else<br />&nbsp;&nbsp; </span>{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; helper.Owner = <span style="color:#2b91af;">GetActiveWindowClass</span>.GetActiveWindow();<br />&nbsp;&nbsp; }<br />&nbsp;&nbsp; <span style="color:blue;">bool</span>? dialogResult = dialog.ShowDialog();<br />&nbsp;&nbsp; <span style="color:blue;">return</span>dialogResult.HasValue ? dialogResult.Value : <span style="color:blue;">false</span>;<br />}</p>
<p>where <span style="color:#2b91af;">GetActiveWindowClass</span>.GetActiveWindow is a interop wrapper</p>
<pre class="code"><span style="color:blue;">public static class </span><span style="color:#2b91af;">GetActiveWindowClass
</span>{
    [<span style="color:#2b91af;">DllImport</span>(<span style="color:#a31515;">"user32.dll"</span>)]
    <span style="color:blue;">public static extern </span><span style="color:#2b91af;">IntPtr </span>GetActiveWindow();
}
</pre>
<p><a href="http://11011.net/software/vspaste"></a>
<pre class="code">&nbsp;</pre>
<pre class="code">&nbsp;</pre>
<pre class="code">&nbsp;</pre>
<pre class="code">&nbsp;</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sarafianalex.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sarafianalex.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=40&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2008/09/12/wpf-showdialog/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
		<item>
		<title>Set a value to a control only in design mode</title>
		<link>http://sarafianalex.wordpress.com/2008/06/14/set-a-value-to-a-control-only-in-design-mode/</link>
		<comments>http://sarafianalex.wordpress.com/2008/06/14/set-a-value-to-a-control-only-in-design-mode/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 23:19:09 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[.NET C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2008/06/14/set-a-value-to-a-control-only-in-design-mode/</guid>
		<description><![CDATA[I have been working on making my project localizable. I made it using Resources just like skins but this will be another post.
The final problem I encountered was that there was no design time support to show a dummy text, in a Button for example. Everything was going well except from the design part which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=23&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have been working on making my project localizable. I made it using Resources just like skins but this will be another post.</p>
<p>The final problem I encountered was that there was no design time support to show a dummy text, in a Button for example. Everything was going well except from the design part which was not that significant for me, but as I&#8217;m the writer of the company&#8217;s new framework it might be for others.</p>
<p>So can you set a value to <span style="color:#2b91af;">DependencyProperty</span> of a <span style="color:#2b91af;">DependencyObject </span>only to in DesignMode?</p>
<p>Using a custom <span style="color:#2b91af;">MarkupExtension</span> you can. Here is the implementation</p>
<blockquote>
<pre>[<span style="color:#2b91af;">ContentProperty</span>(<span style="color:#a31515;">"Value"</span>)]
<span style="color:#0000ff;">public class  </span><span style="color:#2b91af;">DesignTimeDummy </span>: <span style="color:#2b91af;">MarkupExtension</span>
{
<span style="color:#0000ff;">    public </span>DesignTimeDummy()    {

    }
    <span style="color:#0000ff;">public object  </span>Value { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }
    <span style="color:#0000ff;">public override object  </span>ProvideValue
          (<span style="color:#2b91af;">IServiceProvider </span>serviceProvider)
    {
        <span style="color:#0000ff;">if </span>(Helpers.<span style="color:#2b91af;">Designer</span>.InDesignMode)
        {

            <span style="color:#0000ff;">return </span>Value;

        }
        <span style="color:#0000ff;">return </span><span style="color:#2b91af;">DependencyProperty</span>.UnsetValue;
    }

}</pre>
</blockquote>
<p>And this is how you can use it</p>
<blockquote>
<p align="left"><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">Button </span><span style="color:#ff0000;">Style</span><span style="color:#0000ff;">=&#8221;{</span><span style="color:#a31515;">DynamicResource </span><span style="color:#ff0000;">styleName</span><span style="color:#0000ff;">}&#8221; </span><span style="color:#ff0000;">Content</span><span style="color:#0000ff;">=&#8221;{</span><span style="color:#a31515;">CoreME</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">DesignTimeDummy V</span><span style="color:#ff0000;">alue</span><span style="color:#0000ff;">=DesignContentValue}&#8221;/&gt;</span></p>
</blockquote>
<p>or</p>
<p><span style="color:#0000ff;"></p>
<blockquote>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">Button </span><span style="color:#ff0000;">Style</span><span style="color:#0000ff;">="{</span><span style="color:#a31515;">DynamicResource </span><span style="color:#ff0000;">cancelButtonStyle</span><span style="color:#0000ff;">}" &gt;
  &lt;</span><span style="color:#a31515;">Button.Content</span><span style="color:#0000ff;">&gt;
    &lt;</span><span style="color:#a31515;">CoreME</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">DesignTimeDummy</span><span style="color:#0000ff;">&gt;
      </span><span style="color:#a31515;">Dummy
</span><span style="color:#0000ff;">    &lt;/</span><span style="color:#a31515;">CoreME</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">DesignTimeDummy</span><span style="color:#0000ff;">&gt;
  &lt;/</span><span style="color:#a31515;">Button.Content</span><span style="color:#0000ff;">&gt;
&lt;/</span><span style="color:#a31515;">Button</span><span style="color:#0000ff;">&gt;</span></pre>
</blockquote>
<p><span style="color:#0000ff;"></span></p>
<p><span style="color:blue;"><span style="color:#000000;">where CoreME is an xmlns defined namespace shortcut</span></p>
<p></span></span></p>
<p> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sarafianalex.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sarafianalex.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=23&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2008/06/14/set-a-value-to-a-control-only-in-design-mode/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
		<item>
		<title>In design mode</title>
		<link>http://sarafianalex.wordpress.com/2008/06/14/in-design-mode/</link>
		<comments>http://sarafianalex.wordpress.com/2008/06/14/in-design-mode/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 22:59:44 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[.NET C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2008/06/14/in-design-mode/</guid>
		<description><![CDATA[WPF project has begun and I have been continuously finding new things. I&#8217;m very excited, mainly because what I have accomplished to today. Maybe I will write about it.
Many thanks to fellows like Josh,Karl and Sasha for the knowledge I have acquired from them since Summer 2007.
One of the things I needed, for my next [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=22&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>WPF project has begun and I have been continuously finding new things. I&#8217;m very excited, mainly because what I have accomplished to today. Maybe I will write about it.</p>
<p>Many thanks to fellows like Josh,Karl and Sasha for the knowledge I have acquired from them since Summer 2007.</p>
<p>One of the things I needed, for my next post, is to know if code is running in DesignMode or not.</p>
<p>So here is the class I wrote</p>
<pre><span style="color:#0000ff;">public static class </span><span style="color:#2b91af;">Designer
</span>{
    <span style="color:#0000ff;">private static </span><span style="color:#2b91af;">DependencyObject </span>dummy = <span style="color:#0000ff;">new </span><span style="color:#2b91af;">DependencyObject</span>();
    <span style="color:#0000ff;">public static bool </span>InDesignMode
    {
        <span style="color:#0000ff;">get </span>{ <span style="color:#0000ff;">return </span><span style="color:#2b91af;">DesignerProperties</span>.GetIsInDesignMode(dummy); }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sarafianalex.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sarafianalex.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=22&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2008/06/14/in-design-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
		<item>
		<title>Karl on ASP vs WPF</title>
		<link>http://sarafianalex.wordpress.com/2007/12/21/karl-on-asp-vs-wpf/</link>
		<comments>http://sarafianalex.wordpress.com/2007/12/21/karl-on-asp-vs-wpf/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 11:37:16 +0000</pubDate>
		<dc:creator>Sarafian Alex</dc:creator>
				<category><![CDATA[.NET C#]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[3rd Person]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Knowledge]]></category>

		<guid isPermaLink="false">http://sarafianalex.wordpress.com/2007/12/21/karl-on-asp-vs-wpf/</guid>
		<description><![CDATA[Karl Shifflett has posted a very interesting post, regarding what architecture to choose for a new Application Project
His post can be found here and my comments here
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=4&subd=sarafianalex&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Karl Shifflett has posted a very interesting post, regarding what architecture to choose for a new Application Project</p>
<p>His post can be found <a target="_blank" href="http://karlshifflett.wordpress.com/2007/12/20/reasons-for-choosing-wpf-over-aspnet-for-very-large-project/">here</a> and my comments <a href="http://karlshifflett.wordpress.com/2007/12/20/reasons-for-choosing-wpf-over-aspnet-for-very-large-project/#comment-82">here</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sarafianalex.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sarafianalex.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sarafianalex.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sarafianalex.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sarafianalex.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sarafianalex.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sarafianalex.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sarafianalex.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sarafianalex.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sarafianalex.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sarafianalex.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sarafianalex.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sarafianalex.wordpress.com&blog=2367780&post=4&subd=sarafianalex&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sarafianalex.wordpress.com/2007/12/21/karl-on-asp-vs-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/64f00567ef7dda3ec36dcf0e01043d11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sarafian</media:title>
		</media:content>
	</item>
	</channel>
</rss>