<?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/"
	>

<channel>
	
	<atom:link href="http://www.ishraqahmad.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ishraqahmad.com</link>
	<description>Blog for .net Architects &#38; Developers looking to learn WPF, Silverlight, WCF and ASP.net MVC.</description>
	<lastBuildDate>Tue, 30 Aug 2011 01:12:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/08/enhance-your-memory/</link>
		<comments>http://www.ishraqahmad.com/2011/08/enhance-your-memory/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 00:22:07 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Brain]]></category>
		<category><![CDATA[Link Method]]></category>
		<category><![CDATA[Memory]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=343</guid>
		<description><![CDATA[Everyone wants to have photographic memory. Inside brain everything is linked with something. For example, you can still recall the color of your shirt when you received your college degree. The only reason you are able to remember it because it&#8217;s linked with one of the greatest event in your life. Long time ago, I [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone wants to have photographic memory. Inside brain everything is linked with something. For example, you can still recall the color of your shirt when you received your college degree. The only reason you are able to remember it because it&#8217;s linked with one of the greatest event in your life.</p>
<p>Long time ago, I learned an amazing technique to remember sequenced list of items and then recall items in the correct order. It&#8217;s a simple technique and you can remember any number of items with no limits. You can start practice with five items and then gradually increase number of items. You will be amazed with results, when you will be able to recall fifty items in the correct order. Ready? Let&#8217;s get started.</p>
<p>Let say, you are going on a shopping and you need to remember following items.</p>
<p><strong>Tissue, Milk, Fish, Donut, Coffee<br />
</strong></p>
<p>One thing which you can do, which you usually do, is to remember by reading list over and over again. Sometimes, you remember it correctly but sometimes you forget an item. Also, by this way, remembering five items may be easy but how about remembering twenty or fifty items? Would you be able to recall them easily without any aid?</p>
<p>This technique of remembering sequenced list of items is called &#8220;Link Method&#8221;. You will link every item with each other which is exactly how brain works.</p>
<p>In Link method, you will create ridiculous association with between items. First item in list is tissue. Imagine a big roll of tissue equal to the size of a truck tire. Second item is milk and associate with first item by imagining that milk bottle is made of tissue. Off course, in real life you will never get a milk bottle made of tissue. But you need to have a ridiculous association between items. Third item is fish. Normally, on milk bottles we see a picture of cow. But here, you will imagine a picture of fish on milk bottle which is made of tissue. Donut will be associated by visualizing that a fish is eating donut. Last one is coffee and you will imagine that coffee is made up of thousands of tiny donuts.</p>
<p>Now, recall everything in your mind and bring all ridiculous pictures you have imagined. Go to shopping mall and you will be amazed how easily you were able to recall items. After exercising with five item, try same technique with ten and then with twenty items.</p>
<div id="tweetbutton343" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F08%2Fenhance-your-memory%2F&amp;text=Enhance%20your%20memory&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F08%2Fenhance-your-memory%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/08/enhance-your-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/04/software-engineer-should-manage-ui-design-process/</link>
		<comments>http://www.ishraqahmad.com/2011/04/software-engineer-should-manage-ui-design-process/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 19:02:55 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=320</guid>
		<description><![CDATA[A user interface (UI) design is the design of software application or website which focuses on user experience and interaction. The main objective is to keep software application or website as simple as possible so that user can easily use it. Typically, design process involves requirements gathering, prototyping, information architecture and graphical design. Successful CTO&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Verdana;">A user interface (UI) design is the design of software application or website which focuses on user experience and interaction. The main objective is to keep software application or website as simple as possible so that user can easily use it. Typically, design process involves requirements gathering, prototyping, information architecture and graphical design.</span></p>
<p><span style="font-family: Verdana;">Successful CTO&#8217;s say that it is inappropriate to have a software engineers manage UI design process. Why? Well, the answer is simple, do you make UI designer (graduated from Art schools) responsible for software engineering? Of course not! We know UI designers can&#8217;t handle deep technical details and bits/bytes calculation of software development. It will be an utter failure. </span><span style="font-family: Verdana;">Still we allow software engineers to copy and snatch designs from here and there and put them together to look nice. Despite all of us know that 95% of software engineers have no artistic sense. It seems like software engineering is more important than UI design. </span></p>
<p><span style="font-family: Verdana;">Let&#8217;s go back in history. In 1997, Apple stock level was down to its lowest levels and company was in big trouble. At that time, Apple&#8217;s new CEO Steve Jobs did two things, changed company focus to meet customer&#8217;s core requirements and started using industrial design in products. If you ask any financial experts about Apple, you will hear them saying that design saved Apple. Even today, when we think of Apple the first thing comes into mind is artistically designed products which look like pieces of sculpture. So, UI design can save company as it did for Apple.<br />
</span></p>
<p><span style="font-family: Verdana;">Having software engineers participate in UI design could add serious risks to product. There are many factors which forces us take these risks. Number one factor of taking these risks is money. We all want to save money and try to maximize profit by reducing cost of development. Hiring a separate designer and other expenses are much higher as compared to turnkey solutions or stealing from web. Second is time, designers do need time to think and create something using their imagination. They cannot be rushed. I am sure there could be more factors but if we try to evaluate money and time factor versus risks which we add to project. You will find out money and time is far less than the risks of project failure. Imagine, having a design of gray color website for a school and an orange color web site for Supreme Court of the country.<br />
</span></p>
<p><span style="font-family: Verdana;">Last but not least, we should have everyone do their own jobs as jack of all trades rarely succeeds. </span></p>
<div id="tweetbutton320" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F04%2Fsoftware-engineer-should-manage-ui-design-process%2F&amp;text=Software%20Engineer%20should%20manage%20UI%20design%20process%3F&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F04%2Fsoftware-engineer-should-manage-ui-design-process%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/04/software-engineer-should-manage-ui-design-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/do-you-know-what-speed-of-dark-is/</link>
		<comments>http://www.ishraqahmad.com/2011/03/do-you-know-what-speed-of-dark-is/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 11:52:30 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Light]]></category>
		<category><![CDATA[Speed of dark]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/2011/03/do-you-know-what-speed-of-dark-is/</guid>
		<description><![CDATA[Scientists were able to measure speed of light that light travels at 186,000 miles per second. But, did you ever thought about the speed of dark? Well, I am not talking about the famous novel by Elizabeth Moon rather I want to find out why scientists have not been able to determine speed of dark [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Verdana;">Scientists were able to measure speed of light that light travels at 186,000 miles per second. But, did you ever thought about the speed of dark? Well, I am not talking about the famous novel by Elizabeth Moon rather I want to find out why scientists have not been able to determine speed of dark or darkness?<br />
</span></p>
<p><span style="font-family: Verdana;">According to Wikipedia, dark is defined as absence of visible light and has appearance in black color. Scientists explain dark object as object which absorbs photons and therefore appears dim in comparison to other objects. They believe universe is composed of only 0.5% of stars and rest is darkness. Einstein&#8217;s famous theory of relativity also talks about darkness that it&#8217;s the empty space that causes the universe to expand rapidly. General public relates dark with evil, shadows and depression. Believe it or not some enthusiasts tried to measure speed of dark and came up with few theories but no one has the exact answer. First theory says that darkness does not move. It&#8217;s always present everywhere and it&#8217;s the light which overlaps. In other words, consider darkness as table top and light as table cloth. When you pull table cloth from top of table, table becomes dark (which was already present from the beginning). Second theory states that darkness travels at the same speed of light. Both are opposite and equal forces. When one force is absent the other force takes place.<br />
</span></p>
<p style="text-align: center;"><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/032411_1152_Doyouknowwh1.jpg" alt="" /><span style="font-family: Verdana;"><br />
</span></p>
<p><span style="font-family: Verdana;">Let&#8217;s try to use our common sense (in reality it&#8217;s not very common) and see if we can come up with any explanation or answer. Consider that you are standing in an illuminated air tight room with all doors locked and no windows. You are sure that nothing can come from outside. Now, immediately turn off the light. Room went dark and now you can&#8217;t see anything. Did you see darkness coming in or spreading across the room? Where did it come from as room was locked? This proves our first theory that darkness is present everywhere and it&#8217;s the light which overrides darkness for limited time.<br />
</span></p>
<p><span style="font-family: Verdana;">Apart from all this useless discussion, I think, I&#8217;ve found speed of darkness. I calculated speed of dark… oops, I can&#8217;t see, it&#8217;s too dark here. </span></p>
<div id="tweetbutton314" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fdo-you-know-what-speed-of-dark-is%2F&amp;text=Do%20you%20know%20what%20speed%20of%20dark%20is%3F&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fdo-you-know-what-speed-of-dark-is%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/do-you-know-what-speed-of-dark-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/world-water-day-2011-%e2%80%93-water-for-cities/</link>
		<comments>http://www.ishraqahmad.com/2011/03/world-water-day-2011-%e2%80%93-water-for-cities/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 03:47:01 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[World Water Day]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=306</guid>
		<description><![CDATA[In urban cities 3.3 billion human beings are living with the growth rate of 38% which is much faster than expected. The United Nations (UN) sponsor&#8217;s World Water Day once a year and the main objective is to draw human beings attention about growing problem of fresh water shortage. This year&#8217;s theme is &#8220;Water for [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana">In urban cities <strong>3.3 billion</strong> human beings are living with the growth rate of <strong>38%</strong> which is much faster than expected. The United Nations (UN) sponsor&#8217;s <strong>World Water Day</strong> once a year and the main objective is to draw human beings attention about growing problem of fresh water shortage. This year&#8217;s theme is &#8220;<strong>Water for cities: responding to the urban challenge</strong>&#8220;.<br />
</span></p>
<p style="text-align: center"><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/032311_0346_WorldWaterD11.png" alt=""/><span style="font-family:Verdana"><br />
		</span></p>
<p><span style="font-family:Verdana">The dilemma is that small percentages of people are aware of the problem that fresh water is not only consumed for drinking but also used for irrigation and industry. Since last decade fresh water which was an old problem in rural areas, is becoming a huge issue in urban areas as well. On March 22, 2011, UN will hold seminars and meeting in different countries to raise awareness and encourage people to (<em>ref: 2011 advocacy guide</em>),<br />
</span></p>
<ul>
<li><span style="font-family:Verdana">Raise the profile of urban water challenge and generate commitment to tackle this crucial issue.<br />
</span></li>
<li><span style="font-family:Verdana">Facilitate policy dialogue and implementation partnerships for lasting water service improvements.<br />
</span></li>
<li><span style="font-family:Verdana">Promote innovative solutions to provide safe water and sanitation to growing informal settlements.<br />
</span></li>
</ul>
<p><span style="font-family:Verdana">In order to resolve water shortage issues, UN also provides various solutions. Like, providing water and sanitation services in the growing area in informal settlements. Local government and water distribution authorities should ensure water supply in all parts of city including informal settlements. Waste management should be handled properly and encourage recycling as both break and increase issues in water cycling process. We think of NASA (National Aeronautics and Space Administration) as United States government supported organization responsible for aviation and spaceflights. But, you might be surprised that NASA is helping UN by scientifically studying world water cycle. It looks at fine details of natural water cycle that includes measuring changes in snowpack and groundwater level, soil moisture in farms and amount of water consumed by vegetation. According to NASA&#8217;s scientist Bradley Doorn, program manager for agriculture carbon, and water applications in Applied Science Program of NASA&#8217;s Earth science division, we play a key role in trying to understand the supply and demand issues of water. For some people it may seem an easy job that we are just monitoring water cycle through satellites and processing images but there are lots of unknowns which makes it difficult.<br />
</span></p>
<p style="text-align: center"><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/032311_0346_WorldWaterD21.jpg" alt=""/><span style="font-family:Verdana"><br />
		</span></p>
<p><span style="font-family:Verdana"><strong>References:</strong><br />
			<a href="http://www.worldwaterday2011.org/">http://www.worldwaterday2011.org/</a><br />
			<a href="http://www.nasa.gov/topics/earth/">http://www.nasa.gov/topics/earth/</a></span></p>
<div id="tweetbutton306" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fworld-water-day-2011-%25e2%2580%2593-water-for-cities%2F&amp;text=World%20Water%20Day%202011%20%E2%80%93%20Water%20for%20cities&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fworld-water-day-2011-%25e2%2580%2593-water-for-cities%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/world-water-day-2011-%e2%80%93-water-for-cities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/inspirational-quotes/</link>
		<comments>http://www.ishraqahmad.com/2011/03/inspirational-quotes/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 02:18:55 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Quotes]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=297</guid>
		<description><![CDATA[  The strong man is not the good wrestler; the strong man is only the one who controls himself when he is angry. — Prophet Muhammad (PBUH)   The greatest mistake a man can make is to be afraid of making one. — Elbert Hubbard If you want to increase your success rate, double your [...]]]></description>
			<content:encoded><![CDATA[<p>
 </p>
<ul>
<li><span style="font-size:12pt"><strong>The strong man is not the good wrestler; the strong man is only the one who controls himself when he is angry. </strong>— <em>Prophet Muhammad (PBUH)</em><strong><br />
				</strong>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>The greatest mistake a man can make is to be afraid of making one.</strong> — <em>Elbert Hubbard <br/></em><br />
			</span></li>
<li><span style="font-size:12pt"><strong>If you want to increase your success rate, double your failure rate.</strong> — <em>Thomas J. Watson <br/></em><br />
			</span></li>
<li><span style="font-size:12pt"><strong>How pleasant is the day when we give up striving to be young—or slender.</strong> — <em>William James</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>The course of true love never did run smooth.</strong> — <em>William Shakespeare</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>In the depth of winter, I finally learned that there was within me an invincible summer.</strong> — <em>Albert Camus <br/></em><br />
			</span></li>
<li><span style="font-size:12pt"><strong>The perfect is the enemy of the good.</strong> — <em>Voltaire</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>Don&#8217;t forget to love yourself.</strong> — <em>Soren Kierkegaard</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>Those who don&#8217;t know how to weep with their whole heart don&#8217;t know how to laugh either.</strong> — <em>Golda Meir</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>The important work of moving the world forward does not wait to be done by perfect men.</strong> — <em>George Eliot</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>If my aim is to prove I am &#8220;enough,&#8221; the project goes on to infinity—because the battle was already lost on the day I conceded the issue was debatable.</strong> — <em>Nathaniel Branden</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>Two and two do make four. Nature doesn&#8217;t ask your advice. She isn&#8217;t interested in your preferences or whether or not you approve of her laws. You must accept nature as she is with all the consequences that that implies.</strong> — <em>Fyodor Dostoyevsky</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>It&#8217;s not that some people have willpower and some don&#8217;t. It&#8217;s that some people are ready to change and others are not.</strong> — <em>James Gordon</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>Your emotions follow your thoughts, just as surely as baby ducks follow their mother. But the fact that the baby ducks follow faithfully along doesn&#8217;t prove that the mother knows where she is going!</strong> — <em>David Burns</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>In my early professional years I was asking the question: How can I treat, or cure, or change this person? Now I would phrase the question in this way: How can I provide a relationship which this person may use for his own personal growth?</strong> — <em>Carl Rogers</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>To foster a society of total happiness is to concoct a culture of fear.</strong> —<em> Eric Wilson</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>Deep unspeakable suffering may well be called a baptism, regeneration, the initiation into a new state.</strong> — <em>George Eliot</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>We sense that we are impostors. Keeping our feelings a secret, we assume no one on earth is as neurotic, no one as uniquely flawed.</strong> — <em>Diane Ackerman</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>The invariable mark of wisdom is to see the miraculous in the common.</strong> — <em>Ralph Waldo Emerson</em>  <br/><br />
			</span></li>
<li><span style="font-size:12pt"><strong>God, grant me the serenity to accept the things I cannot change, the courage to change the things I can change, and the wisdom to know the difference.</strong> — <em>Reinhold Niebuhr</em><br />
				<br/></span></li>
</ul>
<div id="tweetbutton297" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Finspirational-quotes%2F&amp;text=Inspirational%20Quotes&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Finspirational-quotes%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/inspirational-quotes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/c-is-versus-as-operators/</link>
		<comments>http://www.ishraqahmad.com/2011/03/c-is-versus-as-operators/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 14:28:58 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/2011/03/c-is-versus-as-operators/</guid>
		<description><![CDATA[In programming, most common scenario is to check if object is of given type, object is not null and then type cast it to given type. C# provides &#8220;is&#8221; and &#8220;as&#8221; operators to ease programming and an efficient way to implement this common scenario. Many developers get confuse about when to use &#8220;is&#8221; operator and [...]]]></description>
			<content:encoded><![CDATA[<p>In programming, most common scenario is to check if object is of given type, object is not null and then type cast it to given type. C# provides &#8220;is&#8221; and &#8220;as&#8221; operators to ease programming and an efficient way to implement this common scenario. Many developers get confuse about when to use &#8220;is&#8221; operator and when to utilize &#8220;as&#8221; operator powers. Let&#8217;s examine both operators and see which is better in terms of performance.</p>
<p><strong>is Operator<br />
</strong></p>
<ul>
<li>Checks if object is of given type.</li>
<li>Never throws an exception even if object is null.</li>
<li>Returns True or False.</li>
<li>
<div>When used in &#8220;if&#8221; condition, then CLR has to perform <strong>two cycles</strong> to check if object can be typed cast.</div>
<p><strong>Example code:<br />
</strong><em> </em></p>
<pre class="brush:csharp">// Here, car is object and Car is given type.
Car car = new Car();
if( car is Car )
{
    // car is of type Car.
}</pre>
</li>
</ul>
<p><strong>as Operator<br />
</strong></p>
<ul>
<li>Type casts object to given type.</li>
<li>Never throws an exception even if object is null.</li>
<li>Returns converted object if object can be typed cast to given type else null.</li>
<li>
<div>CLR has to perform only <strong>one cycle</strong> if object can be typed cast to given type.</div>
<p><strong>Example code:<br />
</strong></p>
<p><em> </em></p>
<pre class="brush:csharp">// Here, o is object and Car is given type.
Car car = o as Car;
if( car != null )
{
    // car is of type Car.
}</pre>
</li>
</ul>
<p><strong>Conclusion<br />
</strong>Use &#8220;as&#8221; operator when possible because it improves performance and doesn&#8217;t throw exception.</p>
<div id="tweetbutton291" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fc-is-versus-as-operators%2F&amp;text=C%23%20is%20versus%20as%20operators&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fc-is-versus-as-operators%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/c-is-versus-as-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/wcf-with-entity-framework-tutorial/</link>
		<comments>http://www.ishraqahmad.com/2011/03/wcf-with-entity-framework-tutorial/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 00:35:26 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[WCF]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=273</guid>
		<description><![CDATA[Microsoft always provides efficient, flexible and faster tools for developers. Windows Communications Foundation (WCF) for instance, can be developed using Entity Framework in 2 minutes. You&#8217;re a skeptic? Take a look at following simple tutorial and you will see how quickly you can build ready to use WCF with Entity Framework. In following tutorial, I [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft always provides efficient, flexible and faster tools for developers. Windows Communications Foundation (WCF) for instance, can be developed using Entity Framework in 2 minutes. You&#8217;re a skeptic? Take a look at following simple tutorial and you will see how quickly you can build ready to use WCF with Entity Framework. In following tutorial, I am using <strong>AdventureWorks</strong> database. You can download complete source code from here <a href="http://www.ishraqahmad.com/wp-content/uploads/2011/03/AdventureWorksWCF.zip">AdventureWorksWCF</a>. Let&#8217;s get started,</p>
<ul>
<li>Open Visual Studio 2010 and click on <strong>New Project</strong>. Select <strong>ASP.net Web Application</strong> as project type and click <strong>OK</strong>.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti11.png" alt="" /></li>
<li>Select Project from Solution Explorer, right click and from <strong>Add</strong> menu select <strong>New Item</strong>.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti21.png" alt="" /></li>
<li>From <strong>Add New Item</strong> menu, select <strong>ADO.NET Entity Data Model</strong>. Give descriptive name and press <strong>Add</strong> button.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti31.png" alt="" /></li>
<li>Select <strong>Generate from Database</strong> and press <strong>Next</strong> button in Entity Model Wizard window.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti41.png" alt="" /></li>
<li>Create New Connection or select Existing Connection from connection dropdown. Press <strong>Next</strong> button to continue.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti51.png" alt="" /></li>
<li>For simplicity, we are selecting three tables which are Address, Contact, and ContactType. But, you can choose any number of tables according to your requirements. Press <strong>Finish</strong> to complete wizard.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti61.png" alt="" /></li>
<li>Compile the project and make sure there are no compilation errors. At this point, we have successfully added Entity Model. Let&#8217;s add WCF Data Service in our project.</li>
<li>Again, select project, right click and from<strong> Add </strong>menu<strong><br />
</strong>select <strong>New item</strong>.</li>
<li>From <strong>New Item</strong> window, select <strong>WCF Data Service</strong> and press <strong>Add</strong> button after providing descriptive service name which is AdventureWorksService in our case.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti71.png" alt="" /></li>
<li>Visual Studio automatically opens <strong>AdventureWorksService.svc.cs</strong> file with comments how to link WCF Data Service with Model.<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti8.png" alt="" /></li>
<li>Replace highlighted <span style="color: green; font-family: Consolas; font-size: 9pt;">/* TODO: put your data source class name here */</span> with Entity Model name which will be <strong>AdventureWorksEntities</strong> in this case.</li>
<li>By default, WCF services are secured. We need to add some code so we can access data unrestrictedly. Inside <strong>IntializeService</strong> method, add following code,<br />
<span style="font-family: Consolas; font-size: 9pt;">config.SetEntitySetAccessRule(<span style="color: #a31515;">&#8220;*&#8221;</span>, <span style="color: #2b91af;">EntitySetRights</span>.All);<span style="color: green;"><br />
</span></span></li>
<li>
<div>The modified code will look like this,<br />
<img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti9.png" alt="" /></div>
<p>&nbsp;</li>
<li>
<div>That&#8217;s it. Now, you are ready to consume WCF Service Data. Press <strong>F5</strong> and run project. You see following output,</div>
<p><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031911_0032_WCFwithEnti10.png" alt="" /></li>
<li>Now, you can access your entities by typing names of entity in URL. For example,<br />
<a href="http://localhost:58638/AdventureWorksService.svc/Addresses">http://localhost:58638/AdventureWorksService.svc/Addresses</a><br />
<a href="http://localhost:58638/AdventureWorksService.svc/Contacts">http://localhost:58638/AdventureWorksService.svc/Contacts</a><br />
<a href="http://localhost:58638/AdventureWorksService.svc/ContactTypes">http://localhost:58638/AdventureWorksService.svc/ContactTypes</a></li>
</ul>
<p>You can download complete source code from here <a href="http://www.ishraqahmad.com/wp-content/uploads/2011/03/AdventureWorksWCF.zip">AdventureWorksWCF</a>. If you have questions please don&#8217;t hesitate to contact me.</p>
<div id="tweetbutton273" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fwcf-with-entity-framework-tutorial%2F&amp;text=WCF%20with%20Entity%20Framework%20Tutorial&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fwcf-with-entity-framework-tutorial%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/wcf-with-entity-framework-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/client-side-programming-in-sharepoint-2010/</link>
		<comments>http://www.ishraqahmad.com/2011/03/client-side-programming-in-sharepoint-2010/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 06:53:52 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=251</guid>
		<description><![CDATA[Client side programming in SharePoint has been a hassle and was not fully supported. Although, there were solutions to deploy Silverlight and Ajax based pages in SharePoint 2007 or older versions but still there was no native support by SharePoint. But now, SharePoint 2010 provides client side object model similar to server side object model [...]]]></description>
			<content:encoded><![CDATA[<p>Client side programming in SharePoint has been a hassle and was not fully supported. Although, there were solutions to deploy Silverlight and Ajax based pages in SharePoint 2007 or older versions but still there was no native support by SharePoint. But now, SharePoint 2010 provides client side object model similar to server side object model and natively provides three Client Object models. SharePoint client object models are,</p>
<ul>
<li>
<div><strong>Silverlight<br />
</strong></div>
<p>It&#8217;s defined in <strong>Microsft.SharePoint.Client.Silverlight.dll</strong> and <strong>Microsft.SharePoint.Client.Silverlight.Runtime.dll</strong> assemblies.</li>
<li>
<div><strong>JavaScript<br />
</strong></div>
<p>It&#8217;s defined in <strong>SP.js</strong> file.</li>
<li>
<div><strong>Managed<br />
</strong></div>
<p>It&#8217;s defined in <strong>Microsft.SharePoint.Client.dll</strong> and <strong>Microsft.SharePoint.Client.Runtime.dll</strong> assemblies.</li>
</ul>
<p>Keep an important thing in mind, Client object model is not equivalent to Server object model rather it&#8217;s a subset. These client object models communicate with SharePoint through Windows Communication Foundation (WCF). WCF service is named as <strong>Client.svc</strong>. Communication between client and server object models looks like this,</p>
<p><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031611_0653_ClientSideP11.png" alt="" /></p>
<p>As, you can see above, every request from client comes as XML request and gets JSON response back. To understand clearly, let&#8217;s compare server side model with client models.</p>
<div>
<table style="border-collapse: collapse;" border="0">
<colgroup>
<col style="width: 319px;"></col>
<col style="width: 319px;"></col>
</colgroup>
<tbody>
<tr style="background: #4f81bd;">
<td style="padding-left: 7px; padding-right: 7px; border: solid #4f81bd 1.0pt;"><span style="color: white;"><strong>Silverlight/JavaScript/Managed Client</strong></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid #4f81bd 1.0pt; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;"><span style="color: white;"><strong>Server</strong></span></td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">ClientConext</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">SPConext</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">Site</td>
<td style="padding-left: 7px; padding-right: 7px; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">SPSite</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">Web</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">SPWeb</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">List</td>
<td style="padding-left: 7px; padding-right: 7px; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">SPList</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">ListItem</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">SPListItem</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">Field</td>
<td style="padding-left: 7px; padding-right: 7px; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;">SPField</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>In next posts, we will develop various small applications to find out how easy it is to interact with SharePoint 2010 from client side.</p>
<div id="tweetbutton251" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fclient-side-programming-in-sharepoint-2010%2F&amp;text=Client%20Side%20Programming%20in%20SharePoint%202010&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fclient-side-programming-in-sharepoint-2010%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/client-side-programming-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/wpf-books-and-blogs/</link>
		<comments>http://www.ishraqahmad.com/2011/03/wpf-books-and-blogs/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 14:12:33 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF 4]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/2011/03/wpf-books-and-blogs/</guid>
		<description><![CDATA[Here is the list of some best books and blogs for learning WPF. Blogs &#38; Websites: http://www.windowsclient.net http://www.codeplex.com/wpf http://wpfdisciples.wordpress.com/ http://blogs.msdn.com/tims http://blogs.msdn.com/jaimer Books: Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4 This book is designed for developers encountering WPF for the first time in their professional lives. A working knowledge of C# and [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Verdana;">Here is the list of some best books and blogs for learning WPF.<br />
</span></p>
<p><span style="font-family: Verdana;"><strong>Blogs &amp; Websites:<br />
</strong></span></p>
<ul>
<li><a href="http://www.windowsclient.net/"><span style="font-family: Verdana;">http://www.windowsclient.net</span></a><span style="font-family: Verdana;"><br />
</span></li>
<li><a href="http://www.codeplex.com/wpf"><span style="font-family: Verdana;">http://www.codeplex.com/wpf</span></a><span style="font-family: Verdana;"><br />
</span></li>
<li><a href="http://wpfdisciples.wordpress.com/"><span style="font-family: Verdana;">http://wpfdisciples.wordpress.com/</span></a><span style="font-family: Verdana;"><br />
</span></li>
<li><a href="http://blogs.msdn.com/tims"><span style="font-family: Verdana;">http://blogs.msdn.com/tims</span></a><span style="font-family: Verdana;"><br />
</span></li>
<li><a href="http://blogs.msdn.com/jaimer"><span style="font-family: Verdana;">http://blogs.msdn.com/jaimer</span></a><span style="font-family: Verdana;"><br />
</span></li>
</ul>
<p><span style="font-family: Verdana;"><strong>Books:<br />
</strong></span></p>
<p style="margin-left: 38pt;"><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031211_1412_WPFBooksand13.jpg" alt="" /><span style="font-family: Verdana;"><br />
</span></p>
<p style="margin-left: 38pt;"><a href="http://www.amazon.com/Pro-WPF-2010-Presentation-Foundation/dp/1430272058/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1299938623&amp;sr=1-1"><span style="font-family: Verdana;">Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4</span></a><span style="font-family: Verdana;"><br />
</span></p>
<p style="margin-left: 38pt;"><span style="color: black; font-family: Verdana;">This book is designed for developers encountering WPF for the first time in their professional lives. A working knowledge of C# and the basic architecture of .NET is helpful to follow the examples easily, but all concepts will be explained from the ground up.<br />
</span></p>
<p style="margin-left: 38pt;">&nbsp;</p>
<p style="margin-left: 38pt;"><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031211_1412_WPFBooksand23.jpg" alt="" /><span style="font-family: Verdana;"><br />
</span></p>
<p style="margin-left: 38pt;"><a href="http://www.amazon.com/WPF-4-Unleashed-Adam-Nathan/dp/0672331195/ref=sr_1_2?s=books&amp;ie=UTF8&amp;qid=1299938702&amp;sr=1-2"><span style="font-family: Verdana;">WPF 4 Unleashed</span></a><span style="font-family: Verdana;"><br />
</span></p>
<p style="margin-left: 38pt;"><span style="font-family: Verdana;">Thorough, authoritative coverage, practical examples, clear writing, and full-color presentation make this one of the most widely acclaimed programming books of the last decade.<br />
</span></p>
<p style="margin-left: 38pt;">&nbsp;</p>
<p style="margin-left: 38pt;"><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/031211_1412_WPFBooksand33.jpg" alt="" /><span style="font-family: Verdana;"><br />
</span></p>
<p style="margin-left: 38pt;"><a href="http://www.amazon.com/Applications-Code-Markup-Presentation-Foundation/dp/0735619573/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1299938464&amp;sr=8-1"><span style="font-family: Verdana;">Application = Code + Markup, Charles Petzold</span></a><span style="font-family: Verdana;"><br />
</span></p>
<p style="margin-left: 38pt;"><span style="font-family: Verdana;">Windows programming legend Charles Petzold covers in parallel the two interfaces that make up the Windows Presentation Foundation (WPF). From the outset, the reader can shift focus seamlessly between Extensible Application Markup Language (XAML) and C# to see them as flip sides of the same processes. Beginning in the first chapter, Petzold presents the general syntax of the XAML and corresponding programming code with numerous illuminating examples on how the two correspond and interrelate. The book builds on this base, providing the classic Petzold Windows user interface (UI) treatment, to show Windows developers how to create next-generation interfaces for their applications.</span></p>
<div id="tweetbutton226" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fwpf-books-and-blogs%2F&amp;text=WPF%20Books%20and%20Blogs&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fwpf-books-and-blogs%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/wpf-books-and-blogs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		
		<link>http://www.ishraqahmad.com/2011/03/introduction-to-wpf-4/</link>
		<comments>http://www.ishraqahmad.com/2011/03/introduction-to-wpf-4/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 23:20:06 +0000</pubDate>
		<dc:creator>Ishraq Ahmad</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPF 4]]></category>
		<category><![CDATA[WPF Architecture]]></category>
		<category><![CDATA[XBAP]]></category>
		<category><![CDATA[XPS]]></category>

		<guid isPermaLink="false">http://www.ishraqahmad.com/?p=186</guid>
		<description><![CDATA[Windows Presentation Foundation (WPF) is Microsoft&#8217;s amazing technology for creating windows applications with stunning user interfaces, 3D, videos animations and much more. WPF was first introduced sometime in 2006 and WPF 4 was released in April 2010. You might have heard that &#8220;WPF has a steep learning curve&#8221; but you will notice it&#8217;s not that [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: Verdana;">Windows Presentation Foundation (WPF) is Microsoft&#8217;s amazing technology for creating windows applications with stunning user interfaces, 3D, videos animations and much more. WPF was first introduced sometime in 2006 and WPF 4 was released in April 2010. You might have heard that &#8220;WPF has a steep learning curve&#8221; but you will notice it&#8217;s not that difficult at all. After grasping some new concepts, you will be able to unleash powers of WPF and develop cutting edge applications. In this article, we will look at WPF from developer&#8217;s perspective and learn through practical examples.<br />
</span></p>
<p><span style="font-family: Verdana;"><strong>XAML<br />
</strong>One of the main objectives of WPF is to provide a &#8220;Unified approach to UI&#8221; and let developers focus on coding and designers on creating a design. Microsoft provides an ingenious declarative programming model to define UI. Extensible Markup Language (XAML) not only allows you to define UI but also improved data binding, animations and application styles/themes support. XAML is based on XML style to define objects, properties and logic. Please don&#8217;t mix XML Schema Definition (XSD) with XAML as later is much more powerful. You may be thinking XML based structure, has a bad reputation of providing slow performance but Microsoft solved this problem by converting XAML into BAML (binary representation of XAML) at compile time. Let&#8217;s take an example and try to define a button in XAML and C#,    <strong><br />
</strong></span></p>
<div>
<table style="border-collapse: collapse;" border="0">
<colgroup>
<col style="width: 263px;"></col>
<col style="width: 375px;"></col>
</colgroup>
<tbody>
<tr style="background: #4f81bd;">
<td style="padding-left: 7px; padding-right: 7px; border: solid #4f81bd 1.0pt;"><span style="color: white; font-family: Verdana;"><strong>XAML</strong></span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid #4f81bd 1.0pt; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;"><span style="color: white; font-family: Verdana;"><strong>C#</strong></span></td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid #4f81bd 1.0pt; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;"><span style="font-family: Verdana;"> </span></p>
<pre class="brush:xml">&lt;Button Width="100"&gt;OK
    &lt;Button.Background&gt;
    Green
    &lt;/Button.Background&gt;
&lt;/Button&gt;</pre>
<p><span style="font-family: Verdana;"> </span></td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid #4f81bd 1.0pt; border-right: solid #4f81bd 1.0pt;"><span style="font-family: Verdana;"> </span></p>
<pre class="brush:csharp">Button b1 = new Button();
b1.Content = "OK";
b1.Background = new SolidColorBrush(Colors.Green);
b1.Width = 100;</pre>
<p><span style="font-family: Verdana;"> </span></td>
</tr>
</tbody>
</table>
</div>
<p><span style="font-family: Verdana;">Both generates the same output and are equal. You might be wondering, if I can do it in C# then why I need to learn new declarative language XAML? The answer is coming shortly as there are certain things which XAML can do easily and are quite difficult to do in C#. Plus, XAML is designer friendly and one can use Microsoft Blend (like Photoshop) to define great application UI. Visual Studio also provides a graphical designer to design an amazing UI based on XAML. Idea is to separate UI from logic which is similar to ASP.net web development concept where we have UI defined in ASPX pages and logic in code behind files.<br />
</span></p>
<p><span style="font-family: Verdana;"><strong>WPF Architecture</strong><br />
Before, we look at core features of WPF; let&#8217;s look at WPF architecture so we can see how different layers are interacting with each other.<br />
</span></p>
<p><img src="http://www.ishraqahmad.com/wp-content/uploads/2011/03/030811_2319_Introductio18.png" alt="" /></p>
<p style="margin-left: 108pt;"><span style="color: #4f81bd; font-size: 9pt;"><strong>Figure 1: WPF Architecture (<em>from Microsoft</em>)<span style="font-family: Verdana;"><br />
</span></strong></span></p>
<p><span style="font-family: Verdana;">The core features of WPF shown in yellow are completely managed by WPF. In the middle, WPF Composition Engine shown in black, is very important and responsible for rendering and managing content inside another content. What that means, you can have a video inside a button instead of simple button caption. Now, don&#8217;t take it wrong, WPF is not just about rich user interfaces rather it provides different ways of intelligent data binding, support of XPS allows you create PDF style reports and documents and many more. Furthermore, WPF provides an easy way to integrate your legacy windows applications, media DirectShow, hardware acceleration, DirectX, full advantage of GPU, resolution independent user interface and ClickOnce deployment.<br />
</span></p>
<p><span style="font-family: Verdana;"><strong>WPF Features<br />
</strong></span></p>
<ul>
<li> <span style="font-family: Verdana;"><strong>Style:</strong><br />
Groups different object properties so that other elements can use it easily. For example, you want to have two buttons with green Background and FontSize of 14. One way is to set Background and FontSize of individual buttons but better way is by defining a style and then using that style in buttons. Like this,<br />
&nbsp;</p>
<pre class="brush:xml">&lt;Style x:Key="greenStyle"&gt;
    &lt;Setter Property="Button.FontSize" Value="14"/&gt;
    &lt;Setter Property="Button.Background" Value="Green"/&gt;
&lt;/Style&gt;</pre>
<p><span style="font-family: Verdana;">Now, you can use above style in buttons.<br />
</span></p>
<pre class="brush:xml">&lt;Button Style="{StaticResource greenStyle}"&gt;Next&lt;/Button&gt;
&lt;Button Style="{StaticResource greenStyle}"&gt;Previous&lt;/Button&gt;</pre>
<p></span></li>
<li><span style="font-family: Verdana;"><strong>Template:<br />
</strong>You can completely change control UI but keeping its basic functionality. By default buttons are rectangular but by defining button control template you can have button in circular shape without losing its basic functionality like click event etc.<br />
</span></li>
<li>
<div><span style="font-family: Verdana;"><strong>Layout:</strong><br />
Layouts provides base for application usability and play very important role. WPF provides a set of different layouts, each having unique characteristics.<br />
</span></div>
<p><span style="font-family: Verdana;"><strong>Canvas:</strong><br />
Only layout panel which allows you to specify control position in terms of X and Y coordinates. Always keep in mind an important behavior of Canvas that you cannot set Left and Right or Top and Bottom with same element. Let&#8217;s say, you set Canvas Left to 200 and Right to 100 then Right will be ignored.</span></p>
<pre class="brush:xml">&lt;Canvas&gt;
    &lt;Button Canvas.Left="18" Canvas.Top="18"&gt;&lt;/Button&gt;
&lt;/Canvas&gt;</pre>
<p><span style="font-family: Verdana;"><strong>DockPanel:<br />
</strong>Dock controls without requiring any calculation of X and Y coordinates. Docked element will fill entire width or height of panel.<br />
</span></p>
<pre class="brush:xml">&lt;DockPanel&gt;
        &lt;Button DockPanel.Dock="Top"&gt;I am at top&lt;/Button&gt;
&lt;/DockPanel&gt;</pre>
<p><span style="font-family: Verdana;"><strong>StackPanel:</strong><br />
Stack elements from Left to Right or Top to Bottom depending on Orientation of StackPanel.<br />
</span></p>
<pre class="brush:xml">&lt;StackPanel&gt;
    &lt;Button&gt;Save&lt;/Button&gt;
    &lt;Button&gt;Cancel&lt;/Button&gt;
&lt;/StackPanel&gt;</pre>
<p><span style="font-family: Verdana;"><strong>Grid:<br />
</strong>Most popular and default panel added by Visual Studio.<br />
</span></p>
<pre class="brush:xml">&lt;Grid&gt;
    &lt;Label Grid.Row="1" Grid.Column="0"&gt;Name&lt;/Label&gt;
    &lt;Button Grid.Row="1" Grid.Column="1"&gt;Save&lt;/Button&gt;
&lt;/Grid&gt;</pre>
<p><span style="font-family: Verdana;"><strong>WrapPanel:<br />
</strong>Similar to StackPanel but it wraps elements to next row or column depending on orientation.<br />
</span></li>
<li><span style="font-family: Verdana;"><strong>Data Binding:<br />
</strong>Data binding is the process that establishes a connection between the application UI and business logic. Normally, we consider data binding as binding of input controls to data centric elements like dataset etc. But, in WPF, you can bind to any CLR object including ADO.net or objects associated with Web Services and XML data. Key namespace used in Data Binding is System.Windows.Data.Binding. <strong><br />
</strong></span></li>
<li><span style="font-family: Verdana;"><strong>2-D, 3-D imaging:</strong><br />
WPF provides a list of power API&#8217;s which include Brushes, Shapes, Images, Geometrics, Transformations, Animations, Visual and 3D. Using these API&#8217;s you can easily create stunning user interface instead of gray windows.<br />
</span></li>
<li><span style="font-family: Verdana;"><strong>Audio &amp; Video:<br />
</strong>WPF has a built-in support for wav, asf, mpeg, wma, and avi audio and video formats.<strong><br />
</strong></span></li>
<li><span style="font-family: Verdana;"><strong>XPS documents:</strong><br />
WPF provides complete support of XPS document generation, print, XPS viewer and Open Document Conventions(ODC) for use by any device.<br />
</span></li>
<li><span style="font-family: Verdana;"><strong>ClickOnce deployment</strong><br />
WPF applications can be deployed using traditional MSI setups or ClickOnce. ClickOnce allows you to not only keep track of application version but also updates application automatically if user is using older version.<br />
</span></li>
</ul>
<p><span style="font-family: Verdana;">Hopefully, WPF introduction has given you basic understanding about WPF. In next articles, we will take deep dive and explore WPF in detail.</span></p>
<div id="tweetbutton186" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fintroduction-to-wpf-4%2F&amp;text=Introduction%20to%20WPF%204&amp;related=&amp;lang=en&amp;count=vertical&amp;counturl=http%3A%2F%2Fwww.ishraqahmad.com%2F2011%2F03%2Fintroduction-to-wpf-4%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://www.ishraqahmad.com/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.ishraqahmad.com/2011/03/introduction-to-wpf-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

