<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The MossyBlog Times Archives 2007 - 2009 : APAC Sharepoint</title><link>http://blogs.msdn.com/msmossyblog/archive/tags/APAC+Sharepoint/default.aspx</link><description>Tags: APAC Sharepoint</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>The basics of a Silverlight Control</title><link>http://blogs.msdn.com/msmossyblog/archive/2007/05/14/the-basics-of-a-silverlight-control.aspx</link><pubDate>Sun, 13 May 2007 17:25:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2600644</guid><dc:creator>scbarnes</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/msmossyblog/comments/2600644.aspx</comments><wfw:commentRss>http://blogs.msdn.com/msmossyblog/commentrss.aspx?PostID=2600644</wfw:commentRss><wfw:comment>http://blogs.msdn.com/msmossyblog/rsscomments.aspx?PostID=2600644</wfw:comment><description>&lt;p&gt;I've been sitting here for the past few days really getting my head deeper into Silverlight and I'll post more example's of going from Flex to Silverlight later this week. I will however branch out a bit here and illustrate one nugget that I wish someone had of sat over my shoulder and told me about prior to embarking on Silverlight 101.&lt;/p&gt; &lt;h4&gt;InitializeFromXaml is your friend.&lt;/h4&gt; &lt;p&gt;In C# (Managed Code) I was struggling initially on how the hell do I create children within a Canvas tag for example. In that how does Orcas know how to assemble the pieces together so that I have not only nested children via C# but at the same time, ensuring Silverlight runtime knows as well (ok, one in the same I guess).&lt;/p&gt; &lt;p&gt;How about some code:&lt;br&gt;&lt;br&gt;&lt;font color="#0080c0"&gt;XamlPath = "&lt;strong&gt;com.mossyblog.MyFile.xaml&lt;/strong&gt;";&lt;br&gt;System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream(&lt;strong&gt;XamlPath&lt;/strong&gt;);&lt;br&gt;actualControl = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd()); &lt;/font&gt;&lt;/p&gt; &lt;p&gt;A bunch of stuff happens here in 2 small lines of code, but basically it reads in the file path I pass in (&lt;strong&gt;XamlPath&lt;/strong&gt;) and invokes &lt;strong&gt;this.InitializeFromXaml()&lt;/strong&gt; to effectively read in the file and instantiate this control.  &lt;p&gt;It's important to make mental note of this as when you write your own controls inside Silverlight, you will need to do this for all Controls (unless you extend Canvas or something along those lines).  &lt;p&gt;That being said if you use the example UI Framework (&lt;a href="http://www.microsoft.com/silverlight/tools.aspx" target="_blank"&gt;Located in the Alpha 1.1 SDK&lt;/a&gt;) you can effectively bypass a lot of this by simply extending the &lt;strong&gt;ControlBase Class&lt;/strong&gt; (which does it's own automatic lookup in terms of path finding and appropriate level of instantiation)  &lt;h4&gt;&amp;nbsp;Creating Children from within a Custom Control&lt;/h4&gt; &lt;p&gt;After you master the "How" for bringing in XAML files as controls within your code-behinds, it's now a bit of a head scratching exercise on how one is able to then instantiate sub-children within?&lt;/p&gt; &lt;p&gt;If you do a "this." and await intelli-sense you're not going to see any methods like "add()" which is what you need right?&lt;/p&gt; &lt;p&gt;Well again, looking at the SDK examples you will note the following in some parts:&lt;/p&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;((Canvas)ActualControl).Children.Insert(0, content);&lt;br&gt;&lt;/font&gt;&lt;em&gt;[via ListBox.cs]&lt;/em&gt;&lt;/p&gt; &lt;p&gt;Inside ControlBase class, there is a public property named &lt;strong&gt;AcutalControl&lt;/strong&gt;, which then points to a private property called &lt;strong&gt;actualPath&lt;/strong&gt; which was given it's value based off the result of &lt;strong&gt;this.initializeFromXaml()&lt;/strong&gt; method invocation (Important to note kids).&lt;/p&gt; &lt;p&gt;This specific type returned from doing this is &lt;strong&gt;FrameworkElement&lt;/strong&gt; (which basically means all roads lead back to this guy). Now, FrameworkElement does have&amp;nbsp; Add children methods if you were to read-up on it via the XAML documentation (WPF folks will love it). In Silverlight however, if you were to typecast it as a Canvas element (which is legal) you effectively are then able to use Children.Add( myChild ) approach to life.&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/em&gt;:&lt;/p&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;public VideoThumbNail()&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.setXamlPath("APAC07.Carrousel.VideoThumbNail.xaml");&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.createChildren();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.measure();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.updateDisplayList();&lt;br&gt;}&lt;/font&gt;  &lt;p&gt;&lt;font color="#0080c0"&gt;public void createChildren() {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; base.createChildren(); &lt;/font&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ImageThumbNail it = new ImageThumbNail();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((Canvas)ActualControl).Children.Add(it); &lt;/font&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;}&lt;/font&gt;  &lt;p&gt;I wrote my own event management approach to Silverlight simply because I was bored and thought it may help Adobe Flex Developers understand Silverlight by using similar concepts found within Adobe Flex 2.0.1 framework.&lt;/p&gt; &lt;p&gt;I'm not kidding, with enough time I think I could easily code-port the framework into Silverlight (given&amp;nbsp;Adobe Flex&amp;nbsp;soon&amp;nbsp;will be open source - it may even be legal! hehe).&lt;/p&gt; &lt;p&gt;I hope this helps folks understand how the creation of children happens with managed code inside Silverlight development space. It's pretty straightforward once someone shows you at the start and then from there on out it's just downhill all the way (not as scary).&lt;/p&gt; &lt;p&gt;Back to coding, as I need this demo finished by Wednesday for the &lt;a href="http://www.microsoftsharepoint.com/register/Pages/default.aspx" target="_blank"&gt;APAC Sharepoint&lt;/a&gt; conference where I'll be showing folks how Sharepoint + Silverlight can play a role with one another.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2600644" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/Flex/default.aspx">Flex</category><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/APAC+Sharepoint/default.aspx">APAC Sharepoint</category><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/Sharepoint/default.aspx">Sharepoint</category><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/XAML/default.aspx">XAML</category></item><item><title>Silverlight + Sharepoint</title><link>http://blogs.msdn.com/msmossyblog/archive/2007/05/07/silverlight-sharepoint.aspx</link><pubDate>Mon, 07 May 2007 09:09:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2458612</guid><dc:creator>scbarnes</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/msmossyblog/comments/2458612.aspx</comments><wfw:commentRss>http://blogs.msdn.com/msmossyblog/commentrss.aspx?PostID=2458612</wfw:commentRss><wfw:comment>http://blogs.msdn.com/msmossyblog/rsscomments.aspx?PostID=2458612</wfw:comment><description>&lt;p&gt;Since I'm a crazy 6-fingered, &lt;strike&gt;banjo&lt;/strike&gt; Guitar Hero II playing, glass licking hillbilly from Oz, I decided to Flex my muscles somewhat and do a presentation at next weeks APAC Sharepoint Conference in Sydney - that and Angus Logan got me drunk and somehow managed to get me to agree to do just that.&lt;/p&gt; &lt;p&gt;Seriously, I'll be hopefully (if I can get the demo finished in time) showing one and all how Silverlight + Sharepoint can play a role with one another.&lt;/p&gt; &lt;p&gt;I'll never drink again as I'm not even sure if anyone else in the world has done this yet, way to go Scott! :)&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;The exclusive Microsoft&lt;sup&gt;®&lt;/sup&gt; APAC SharePoint&lt;sup&gt;®&lt;/sup&gt; Conference 2007 is the third and final of three global SharePoint Conferences, following Seattle and Berlin. This world-class, two-day conference, to be held at the &lt;/em&gt;&lt;a href="http://www.hiltonsydney.com.au/"&gt;&lt;em&gt;Hilton Hotel in Sydney&lt;/em&gt;&lt;/a&gt;&lt;em&gt; from May 15-16, will showcase the latest innovations, features and functionality for the 2007 SharePoint products and technologies.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;[ &lt;a href="http://www.microsoftsharepoint.com" target="_blank"&gt;More info on APAC Sharepoint Conference 2007&lt;/a&gt; ]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2458612" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/APAC+Sharepoint/default.aspx">APAC Sharepoint</category><category domain="http://blogs.msdn.com/msmossyblog/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item></channel></rss>