<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Jonathan Mast - Silverlight</title><link>http://www.jonathanpmast.com:80/Tags/Silverlight</link><description>Jonathan Mast - Silverlight</description><item><title>Silverlight Sizing DataGridColumn Width to occupy remaining width of grid</title><link>http://www.jonathanpmast.com:80/blog/Silverlight-Sizing-DataGridColumn-Width-to-occupy-remaining-width-of-grid</link><description>&lt;div class="wlWriterHeaderFooter" style="float:right; margin:0px; padding:0px 0px 4px 8px;"&gt;
&lt;script type="text/javascript"&gt;&lt;!--
digg_url = "http://www.jonathanpmast.com/blog/post/2010/02/11/Silverlight-Sizing-DataGridColumn-Width-to-occupy-remaining-width-of-grid.aspx";digg_title = "Silverlight Sizing DataGridColumn Width to occupy remaining width of grid";digg_bgcolor = "#FFFFFF";digg_skin = "normal";
// --&gt;&lt;/script&gt;
&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;&lt;!--
digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;
// --&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;p&gt;So lets say you want a datagridcolumn in silverlight to occupy all of the remaining width in a datagrid (can&amp;rsquo;t do this without writing code in Silverlight&amp;hellip; Auto just expands to fit content and there&amp;rsquo;s no * like there is in layout controls).&lt;/p&gt;
&lt;p&gt;Pretty simple to do, I did it in the LayoutUpdated event.&amp;nbsp; Here&amp;rsquo;s the code to do it:&lt;/p&gt;
&lt;p&gt;[code:c#]&lt;/p&gt;
&lt;p&gt;private void dg_LayoutUpdated(object sender, EventArgs e) &lt;br /&gt;{ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (dg.ActualWidth != double.NaN &amp;amp;&amp;amp; dg.ActualWidth &amp;gt; 0.0 &amp;amp;&amp;amp; !_ColWidthSet) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _ColWidthSet = true; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double dgTotalWidth = dg.ActualWidth; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // offset to handle vertical scrollbar starts at positive nbr &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double initialColumnWidth = 20; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; dg.Columns.Count - 1; i++) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initialColumnWidth += dg.Columns[i].ActualWidth; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dg.Columns[dg.Columns.Count - 1].Width = new DataGridLength(dgTotalWidth - initialColumnWidth); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;[/code]&lt;/p&gt;
&lt;p&gt;Edit: if you are curious _ColWidthSet is just a boolean control variable that prevents the code from executing over and over again.&amp;nbsp; The layoutupdated event fires quite a bit, ie when users scroll etc.&lt;/p&gt;</description><pubDate>Fri, 10 Sep 2010 17:21:17 GMT</pubDate><guid isPermaLink="true">http://www.jonathanpmast.com:80/blog/Silverlight-Sizing-DataGridColumn-Width-to-occupy-remaining-width-of-grid</guid></item><item><title>Silverlight Client Object Model, mysterious errors</title><link>http://www.jonathanpmast.com:80/blog/Silverlight-Client-Object-Model-mysterious-errors</link><description>&lt;p&gt;So in the tech preview version of SP 2010 that I'm working with, the Client Object Model (ClOM)is kind of tricky to get working.&amp;nbsp; You'll find the basic steps in getting it configured over the last couple posts on this space; but there was one thing I didn't think of: clientaccesspolicy/crossdomain&lt;/p&gt;
&lt;p&gt;I've done quite a bit of Silverlight Development in SP2007, so getting the XDomain.xml file in there was nothing new to me.&amp;nbsp; The trick was the fact that the Call to the ExecuteQuery method on the ClOM would return a failure state, but the FailureArguments were always empty--no message, no stack trace, or anything.&amp;nbsp; One of the nice things about Silverlight (or any Service-based) development is the number of debugging and diagnostic tools at your disposal--its easy to isolate the module/component/layer that is giving your application problems.&amp;nbsp; In this case, I wanted to look at the requests back and forth between my Silverlight app and the ClientContext, which I knew was implemented through a WCF interface.&amp;nbsp; Fiddler showed me that the crossdomain.xml file was being requested with a 404 (not found) response from the server.&amp;nbsp; It also showed me exactly where the XDomain file needed to go to get it working!&amp;nbsp; Once I fired up SPD2010 and created my xml file in the root site, everything was working charmingly.&amp;nbsp; And fiddler even showed me that too: (finally took a screener of that)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="/Media/Default/Images/2009%2f10%2fCLOM_Fiddler.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;BTW, if the SL app i was debugging was actually deployed to the SP Site itself, the XDomain policy wouldn't even be in play b/c SL would be speaking within the same internet domain.&lt;/p&gt;
&lt;p&gt;Once I get the demo a little more interesting, I'll post some notes around it.&lt;/p&gt;</description><pubDate>Sun, 04 Apr 2010 05:37:40 GMT</pubDate><guid isPermaLink="true">http://www.jonathanpmast.com:80/blog/Silverlight-Client-Object-Model-mysterious-errors</guid></item><item><title>Presenting @ Cincinnati SharePoint UG on October 1st</title><link>http://www.jonathanpmast.com:80/blog/Presenting-Cincinnati-SharePoint-UG-on-October-1st</link><description>&lt;p&gt;There’s nothing I love more than talking the technology side of… just about anything.&amp;#160; Next Thursday, I’ll be presenting at the &lt;a href="http://cincyspug.securespsites.com/default.aspx" target="_blank"&gt;Cincinnati SharePoint User Group&lt;/a&gt; (CincySpug).&amp;#160; One of my colleagues is presenting with a customer of ours regarding SharePoint Governance, and how a tool that my organization built was leveraged to implement a Governance plan.&lt;/p&gt;  &lt;p&gt;I’ll be delivering the Technical presentation (following the Biz Value, above) with a focus on SharePoint as an Application Development Platform.&amp;#160; I’m going focus on the Site Provisioning needs of a Governance Plan (which along with Security and Access Management, tends to be the most pervasive issue surrounding governance) to show how the Governance Solution has leveraged SharePoint as an App Dev platform, and also how the Solution itself can be extended in a composite way to integrate with different workflow and instrumentation engines.&amp;#160; There also may be some Silverlight in SharePoint goodness there…&lt;/p&gt;  &lt;p&gt;Its been an extremely busy last few weeks.&amp;#160; I have two articles that I’ve been working on with some code samples.&amp;#160; They’re both about 60% complete.&amp;#160; One is around leveraging Silverlight in Custom Field Types (it actually can take a lot of the pain out of Custom Field Type development) and all of the micro-issues that surround that, like subscribing to managed code events from JavaScript; the other is a smaller write-up on some cool stuff I’ve recently done with LINQ to XML and InfoPath.&amp;#160; (BTW—if you are, or aspire to be, a SharePoint Developer, &lt;a href="http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/Developer-Video.aspx" target="_blank"&gt;learning the ins and outs of LINQ syntax is highly recommended&lt;/a&gt;).&lt;/p&gt;</description><pubDate>Thu, 01 Oct 2009 23:02:54 GMT</pubDate><guid isPermaLink="true">http://www.jonathanpmast.com:80/blog/Presenting-Cincinnati-SharePoint-UG-on-October-1st</guid></item><item><title>Applying Model-View-View Model in Silverlight -- Visual Studio Magazine</title><link>http://www.jonathanpmast.com:80/blog/Applying-Model-View-View-Model-in-Silverlight-Visual-Studio-Magazine</link><description>&lt;p&gt;I’m a huge proponent of MVVM, particularly in SL and WPF applications.&amp;#160; I think the design and development paradigm for these tools is significantly different than ASP.NET and Windows Forms development.&amp;#160; If you are considering dipping your tow into either domain, I’d recommend reading up on MVVM, and this is a good place to start. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://visualstudiomagazine.com/Articles/2009/09/01/Applying-MVVM-in-Silverlight.aspx"&gt;Applying Model-View-View Model in Silverlight -- Visual Studio Magazine&lt;/a&gt;&lt;/p&gt;</description><pubDate>Tue, 15 Sep 2009 17:07:02 GMT</pubDate><guid isPermaLink="true">http://www.jonathanpmast.com:80/blog/Applying-Model-View-View-Model-in-Silverlight-Visual-Studio-Magazine</guid></item></channel></rss>