Silverlight 2.0 Cross Domain Calls

I was just reading Scott Guthries blog post about silverlight 2.0 and I came across a section discussing how Silverlight will be able to do cross domain calls. I have been very curious how they were planning on solving this one without risking the security of silverlight.

It turns out that all you need on the remote domain is an XML policy file that will allow applications to call your domain directly. It seems that this is how flash has been doing it for a while now and silverlight 2.0 will also respect flash policy files.

Flash vs. Silverlight, Indeed

I was just looking at and decided to put in Flash vs. Silverlight. The results are pretty interesting:

At the time of this posting flash goes from 0% in May ’05 to about 100% in Sept ’07 while silverlight has gone from 0 at May ’07 to 1,300% in Oct. ’07. I guess we can see that Microsoft has done a good job of getting people excited about Silverlight. Now all they need to do is devliver the goods.

Also, one other interesting thing is how F# creates a graph that sort of looks like the New York skyline:

That seems pretty ironic from a functional language.

Dynamic Templated TreeViewItem in WPF

I struggled with this for a long time for some reason so I decided to post a simple example here for everyone who may be encountering the same thing. The scenario I have here is when you have a treeview with several hardcoded treeview items and at the lowest levels of leafs you have them bound to some data provider. The trick is trying to dynamically bind the treeview items to different data templates based on some criteria.

The real example was to have a label and a text box for the dynamic items based on whether you are trying to edit it or not. The trick turned out to be to wrap your DataTemplate in a control and use styling to dynamically switch it.

 Download Sample Project










   <ControlTemplate x:Key=”SelectedTemplate” TargetType=”{x:Type Control}”>

    <Label Content=”{Binding XPath=title}” Foreground=”Red” FontWeight=”Bold”  />


   <ControlTemplate x:Key=”DefaultTemplate” TargetType=”{x:Type Control}”>

    <Label Content=”{Binding XPath=title}” />


   <DataTemplate x:Key=”template”>

    <Control Focusable=”False”>


      <Style TargetType=”{x:Type Control}”>

       <Setter Property=”Template” Value=”{StaticResource DefaultTemplate}” />                           


         <Trigger Property=”IsMouseOver” Value=”True”>

          <Setter Property=”Template” Value=”{StaticResource SelectedTemplate}” />







    <XmlDataProvider x:Key=”justnbusiness” Source=”; />           

















     Source={StaticResource justnbusiness},


    ItemTemplate=”{StaticResource template}”

    Header=”Blog Posts”/>



















Twin Cities Code Camp Spring 2008

I will be giving another talk at the next Twin Cities Code Camp about Visual Studio integration. The event is on April 5th and is free so you should definitely come down and make me sweat with questions that I cannot answer!

I plan on talking about visual studio integration in general but I will hopefully show off the current state of the NBusiness 3 plugin as well.