title: WPF GridLength in XAML
body: <p>I'm trying to define a common Width resource in Common.xaml which will be shared by different controls, like following:</p>
  
  <pre><code>&lt;GridLength x:Key="CommonWidth"&gt;20&lt;/GridLength&gt;
  </code></pre>
  
  <p>I then use it in a Button style defined in ButtonStyle.xaml</p>
  
  <pre><code>&lt;Style x:Key="ButtonStyle" TargetType="{x:Type Button}"&gt;
      &lt;Setter Property="Width" Value="{DynamicResource CommonWidth}"/&gt;
      ....
  &lt;/Style&gt;
  </code></pre>
  
  <p>Common.xaml is included before ButtonStyle.xaml in the ResourceDictionary definition in App.xaml. When I ran the application (on .Net3.5 SP1), I got the following exception:</p>
  
  <pre><code>'20' is not a valid value for property 'Width'.
  </code></pre>
  
  <p>Anyone has any ideas of what I have done wrong? Thanks in advance.</p>