title: Using system types in XAML as resources
body: <p>I have encountered a situation where it would be very useful to specify a floating point value directly in XAML and use it as a resource for several of my UI pieces.  After searching around I found a good amount of information on how to include the proper assembly (mscorlib) in your XAML so you can do just that.</p>
  
  <p>Unfortunately, I am getting an exception in one instance where I try to do this.  Here is the following XAML that recreates the situation:</p>
  
  <pre><code>&lt;Window x:Class="davidtestapp.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:core="clr-namespace:System;assembly=mscorlib"
      Title="MainWindow" Height="350" Width="525"&gt;
  
  &lt;Window.Resources&gt;
      &lt;core:Double x:Key="MyDouble"&gt;120&lt;/core:Double&gt;
  &lt;/Window.Resources&gt;
  
  &lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="{StaticResource MyDouble}" /&gt;
          &lt;ColumnDefinition Width="40" /&gt;
          &lt;ColumnDefinition Width="40" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
  
      &lt;Rectangle Grid.Column="0" Fill="Red" /&gt;
      &lt;Rectangle Grid.Column="1" Fill="Green" /&gt;
      &lt;Rectangle Grid.Column="2" Fill="Blue" /&gt;
  
  &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>When I attempt to compile and run this, I get an XamlParseException thrown at me which says that "'120' is not a valid value for property 'Width'".</p>
  
  <p>But the "Width" property <em>is</em> a double, so why can't I set it using the StaticResource which was defined?  Does anyone know how to do this?</p>