<?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>
	<title>Ananth&#039;s very own website &#187; Xaml</title>
	<atom:link href="http://ananthonline.net/category/blog/xaml/feed" rel="self" type="application/rss+xml" />
	<link>http://ananthonline.net</link>
	<description>Nemo vir est qui mundum non reddat meliorem</description>
	<lastBuildDate>Sun, 29 Jan 2012 05:04:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Markup extensions in Xoml</title>
		<link>http://ananthonline.net/2008/05/04/markup-extensions-in-xoml/</link>
		<comments>http://ananthonline.net/2008/05/04/markup-extensions-in-xoml/#comments</comments>
		<pubDate>Sun, 04 May 2008 17:06:49 +0000</pubDate>
		<dc:creator>ananth</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Xaml]]></category>
		<category><![CDATA[Xoml]]></category>

		<guid isPermaLink="false">http://blog.ananthonline.net/?p=19</guid>
		<description><![CDATA[ Tweet <p>One of the features I spent a lot of time thinking about, and implementing are: &#8220;deferred&#8221; ProvideValue calls on MarkupExtensions. In a XAML markup extension, ProvideValue is called when the tree is being loaded, and sometimes, it may be impossible to provide a value at that time. Also, since XAML makes use of [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fananthonline.net%2F2008%2F05%2F04%2Fmarkup-extensions-in-xoml%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://ananthonline.net/2008/05/04/markup-extensions-in-xoml/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://ananthonline.net/2008/05/04/markup-extensions-in-xoml/"  data-text="Markup extensions in Xoml" data-count="horizontal" data-via="ananthonline">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ananthonline.net/2008/05/04/markup-extensions-in-xoml/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>One of the features I spent a lot of time thinking about, and implementing are: &#8220;deferred&#8221; ProvideValue calls on MarkupExtensions. In a XAML markup extension, ProvideValue is called when the tree is being loaded, and sometimes, it may be impossible to provide a value at that time. Also, since XAML makes use of internal classes like ResourceReferenceExpression (along with some other quirks like requiring derivation from FrameworkElement. More on this <a href="http://blog.ananthonline.net/?p=7" target="_blank">here</a>), it becomes quite a messy task resolving these references and values later.</p>
<p>In Xoml, however, every markup extension can tell XomlLoader to defer<em> </em>its ProvideValue call, by setting defer to true.</p>
<blockquote><p><span style="font-size: 8pt; color: blue; line-height: 115%; font-family: consolas">public</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> </span><span style="font-size: 8pt; color: blue; line-height: 115%; font-family: consolas">abstract</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> </span><span style="font-size: 8pt; color: blue; line-height: 115%; font-family: consolas">object</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> ProvideValue(</span><span style="font-size: 8pt; color: blue; line-height: 115%; font-family: consolas">object</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> context, </span><span style="font-size: 8pt; color: #2b91af; line-height: 115%; font-family: consolas">PropertyInfo</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> property, </span><span style="font-size: 8pt; color: blue; line-height: 115%; font-family: consolas">out</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> </span><span style="font-size: 8pt; color: blue; line-height: 115%; font-family: consolas">bool</span><span style="font-size: 8pt; color: black; line-height: 115%; font-family: consolas"> defer);</span></p></blockquote>
<p>Of course, at this point the markup extension is also expected to provide a default value, one that can be assigned to the context without errors. It is important to remember that the &#8220;context&#8221; can also be other markup extensions, in the case of a nested sub-expression.</p>
<p>After the entire object tree has been loaded, DeferredProvideValue</p>
<blockquote><p><span style="color: blue">public</span> <span style="color: blue">virtual</span> <span style="color: blue">object</span> DeferredProvideValue(<span style="color: blue">object</span> root, <span style="color: blue">object</span> context, <span style="color: #2b91af">PropertyInfo</span> property)</p></blockquote>
<p>is called once for each ProvideValue call that was deferred. Since the tree has been loaded now, the partially-initialized(?) root object is also passed in. XomlLoader then calls the OnAfterLoad method on each markup extension that was found.</p>
<blockquote>
<p style="background: white none repeat scroll 0% 50%; font-size: 8pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: consolas">
<p style="margin: 0px"><span style="color: blue">protected</span> <span style="color: blue">internal</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> OnAfterLoad(<span style="color: #2b91af">AfterLoadEventArgs</span> e)</p>
</blockquote>
<p>This calling order is undefined, and extensions that have not been used in the currently loaded XOML are not called upon for OnAfterLoad processing. OnAfterLoad is called exactly once for each type of extension, its calling order is undefined. Like DeferredProvideValue, the root of the tree is provided to this method. The difference here, however is that OnAfterLoad can return a <em>different</em> object back to XomlLoader (through AfterLoadEventArgs), thus changing the whole tree! I&#8217;m not sure if this is an irresponsible thing to do, I thought it might help do radical things to the object tree and make it more extensible.</p>
<p>I would love to hear your thoughts on the features I&#8217;ve currently implemented, and future directions for development.</p>
]]></content:encoded>
			<wfw:commentRss>http://ananthonline.net/2008/05/04/markup-extensions-in-xoml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>XAML without WPF = XOML</title>
		<link>http://ananthonline.net/2008/04/13/xaml-without-wpf-xoml/</link>
		<comments>http://ananthonline.net/2008/04/13/xaml-without-wpf-xoml/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 22:58:16 +0000</pubDate>
		<dc:creator>ananth</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Xaml]]></category>
		<category><![CDATA[Xoml]]></category>

		<guid isPermaLink="false">http://blog.ananthonline.net/?p=16</guid>
		<description><![CDATA[ Tweet <p>For a long time, I&#8217;ve been writing about how messed up Xaml is because of WPF-interdependency, and how Microsoft should have decoupled the Xaml bits from WPF, etc (Some of these rants were on my old blog). Well, I finally decided to do something about it, and I&#8217;m writing a XAML-like library that [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fananthonline.net%2F2008%2F04%2F13%2Fxaml-without-wpf-xoml%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://ananthonline.net/2008/04/13/xaml-without-wpf-xoml/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://ananthonline.net/2008/04/13/xaml-without-wpf-xoml/"  data-text="XAML without WPF = XOML" data-count="horizontal" data-via="ananthonline">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ananthonline.net/2008/04/13/xaml-without-wpf-xoml/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>For a long time, I&#8217;ve been writing about how messed up Xaml is because of WPF-interdependency, and how Microsoft should have decoupled the Xaml bits from WPF, etc (Some of these rants were on my old blog). Well, I finally decided to <em>do</em> something about it, and I&#8217;m writing a XAML-like library that loads, and writes markup using its own XomlLoader and XomlWriter. At this point I&#8217;m calling the markup e<strong>X</strong>tensible <strong>O</strong>bject <strong>M</strong>arkup <strong>L</strong>anguage (I know that the Workflow Foundations&#8217; designer files have that extension&#8230;) because that&#8217;s what its meant to be. It is also aimed to run on the .NET Framework, Mono and the .NET CF. <img src='http://ananthonline.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Using Xoml, you will be able to data-bind, forward reference, resource reference, write markup-extensions and more. I will be putting this project up for download shortly, look out for more news on it.</p>
<p>PS: If there&#8217;s enough interest, it will have its own mini-site here!</p>
]]></content:encoded>
			<wfw:commentRss>http://ananthonline.net/2008/04/13/xaml-without-wpf-xoml/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Resolving forward references in XAML</title>
		<link>http://ananthonline.net/2007/08/15/resolving-forward-references-in-xaml/</link>
		<comments>http://ananthonline.net/2007/08/15/resolving-forward-references-in-xaml/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 15:57:36 +0000</pubDate>
		<dc:creator>ananth</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Xaml]]></category>

		<guid isPermaLink="false">http://blog.ananthonline.net/?p=7</guid>
		<description><![CDATA[ Tweet <p>It&#8217;s great that you can reference other objects in a resource dictionary in a XAML file. This makes it particularly interesting to me, since I go the whole hog and almost everything is a resource. For example, in my application (its a sort of scene graph), textures, materials and even animations are resources [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fananthonline.net%2F2007%2F08%2F15%2Fresolving-forward-references-in-xaml%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://ananthonline.net/2007/08/15/resolving-forward-references-in-xaml/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://ananthonline.net/2007/08/15/resolving-forward-references-in-xaml/"  data-text="Resolving forward references in XAML" data-count="horizontal" data-via="ananthonline">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ananthonline.net/2007/08/15/resolving-forward-references-in-xaml/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>It&#8217;s great that you can reference other objects in a resource dictionary in a XAML file. This makes it particularly interesting to me, since I go the whole hog and almost everything is a resource. For example, in my application (its a sort of scene graph), textures, materials and even animations are resources which other objects can reference. This makes things easier for me, allowing one instance of a potentially costly resource (like a large texture, or a vertex/pixel shader) to be used by multiple consumers. I suppose the same example could be applied to other cases as well. Resource sharing is a good thing, period. Well &#8230; this comes with its own set of problems with Xaml. Unless you hand-write <em>all</em> the XAML, <a href="http://msdn2.microsoft.com/en-us/library/ms750950.aspx" target="_blank">StaticResource</a> is practically useless unless you are guaranteed to have no forward references. This is understandable, and even the MSDN documentation says so quite clearly. The alternative is to use <a href="http://msdn2.microsoft.com/en-us/library/ms748942.aspx" target="_blank">DynamicResource</a> to resolve these references. Or so it says.</p>
<p>Trying it out, it seems that <a href="http://msdn2.microsoft.com/en-us/library/ms748942.aspx" target="_blank">DynamicResource</a> returns an internal class, ResourceReferenceExpression from ProvideValue, which is a way to tell the XAML parser to defer resolving this expression. But how and when does the expression actually get resolved? Its supposed to be resolved the first time its accessed, which unfortunately doesn&#8217;t seem to be the case. The resolving part seems to be tied down to a method (GetRawValue) that assumes the objects are derived from <a href="http://msdn2.microsoft.com/en-us/library/system.windows.frameworkelement.aspx" target="_blank">FrameworkElement</a>. It also seems there&#8217;s no way to do any of this yourself since almost everything of any value is internal or sealed. All&#8217;s not lost, however, since <a href="http://msdn2.microsoft.com/en-us/library/ms748942.aspx" target="_blank">DynamicResource</a> is not sealed <img src='http://ananthonline.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . See, while we could very well write a custom markup extension, its ProvideValue would have to return null when <a href="http://msdn2.microsoft.com/en-us/library/system.windows.markup.xamlreader.aspx" target="_blank">XamlReader</a> invokes it. This is a problem, and many objects won&#8217;t work properly when we do this. The alternative is to derive from <a href="http://msdn2.microsoft.com/en-us/library/ms748942.aspx" target="_blank">DynamicResource</a>, and return base.ProvideValue which is a ResourceReferenceExpression. At the same time, we note down the resources that require resolving in a static table. We can then use this table after the load to resolve all references. <a href="http://blog.ananthonline.net/wp-content/uploads/2007/08/resolvingresources.zip" title="Attached">Attached</a> is a VS2008 project that implements a ResourceExtension markup extension. There are some limitations to the code I&#8217;ve written, for example: it doesn&#8217;t take care of a resource reference that references another. For this ,we need to resolve in a particular order. But you get the idea, right?</p>
<p>So far, there&#8217;s no mention of how to write expressions to a XAML file. <a href="http://msdn2.microsoft.com/en-us/library/system.windows.markup.xamlwriter.aspx" target="_blank">XamlWriter</a> just wont do, since it will write the value of the property, and not the expression used to calculate it. Next time, we&#8217;ll talk about some a custom <a href="http://http://msdn2.microsoft.com/en-us/library/system.windows.markup.xamlwriter.aspx" target="_blank">XamlWriter</a> and some problems in that context.</p>
]]></content:encoded>
			<wfw:commentRss>http://ananthonline.net/2007/08/15/resolving-forward-references-in-xaml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xaml != WPF</title>
		<link>http://ananthonline.net/2007/08/08/xaml-wpf/</link>
		<comments>http://ananthonline.net/2007/08/08/xaml-wpf/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 13:54:31 +0000</pubDate>
		<dc:creator>ananth</dc:creator>
				<category><![CDATA[Xaml]]></category>

		<guid isPermaLink="false">http://blog.ananthonline.net/?p=6</guid>
		<description><![CDATA[ Tweet <p>Every time I see something about XAML, its always WPF. Sure, WPF was probably the reason XAML has come into being, but its so much more than just a backbone for a presentation framework.</p> <p>Just googling for XAML gives me this, all of it WPF. Well don&#8217;t flame this post just yet. Sure, [...]]]></description>
			<content:encoded><![CDATA[<div class="bottomcontainerBox" style="">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fananthonline.net%2F2007%2F08%2F08%2Fxaml-wpf%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://ananthonline.net/2007/08/08/xaml-wpf/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://ananthonline.net/2007/08/08/xaml-wpf/"  data-text="Xaml != WPF" data-count="horizontal" data-via="ananthonline">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://ananthonline.net/2007/08/08/xaml-wpf/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div><p>Every time I see something about XAML, its always WPF. Sure, WPF was probably the reason XAML has come into being, but its so much more than just a backbone for a presentation framework.</p>
<p>Just googling for XAML gives me <a href="http://www.google.co.in/search?q=Xaml&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t" target="_blank">this</a>, all of it WPF. Well don&#8217;t flame this post just yet. Sure, its was meant for WPF, that&#8217;s dandy. But is that all you can use it for? No, surely not. So what else can we do with it? For starters, its a format we can store objects in. No, its not just like storing objects as XML, because we can actually &#8220;refer&#8221; to other objects in the tree. Or execute code to determine the value of an attribute (which would be a property on some object) and more, all in markup!</p>
<p>I&#8217;m not about to explain what XAML is, and how to use it to save and load objects or how to write markup extensions. You can learn a lot more about the basics from this excellent article by Peter Himschoot, <a href="http://www.microsoft.com/belux/msdn/nl/community/columns/himschoot/amazingxaml.mspx" target="_blank">here</a>.</p>
<p>What I will do, is write a set of articles on some of hurdles I&#8217;ve faced reading and writing XAML that is <strong>not</strong> for WPF, and what I did to get around it. I also hope to make this a definitive resource with links to code and other resources for anyone wishing to do GPXAML (General Purpose XAML) as my friend and I have dubbed it.</p>
<p>Coming up real soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://ananthonline.net/2007/08/08/xaml-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

