title: XamlReader.Load can't find static resources
body: <p>Creating column at runtime, with DataTemplateSelector. Have exception at XamlReader.Load: System.Windows.StaticResourceExtension. How can i load resources?</p>
  
  <pre><code>var column = new DataGridTemplateColumn();
              column.Header = (i.Hour + 1).ToString();
              column.Width = 30;
  var parserContext = new ParserContext();
  parserContext.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
  parserContext.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
  parserContext.XmlnsDictionary.Add("local", "clr-namespace:ССПИ;assembly=ССПИ");
  column.CellTemplateSelector = (DataTemplateSelector)XamlReader.Load(
                  new MemoryStream(Encoding.Default.GetBytes(
                      @"&lt;local:ExtendedTemplateSelector TextBlockTemplate='{StaticResource TextBlockTemplate}' CheckBoxTemplate='{StaticResource CheckBoxTemplate}'/&gt;"
                  )),parserContext);        
  dataGrid1.Columns.Add(column);
  
  &lt;DataGrid DataGridCell.Selected="DataGrid_GotFocus" EnableColumnVirtualization="true" EnableRowVirtualization="true" Name="dataGrid1" DockPanel.Dock="Top" AutoGenerateColumns="False" 
                     Height="120" Width="Auto" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserAddRows="false" CanUserResizeRows="False" CanUserSortColumns="False" CellEditEnding="dataGrid1_CellEditEnding" ContextMenuOpening="dataGrid1_ContextMenuOpening"&gt;
                      &lt;DataGrid.Resources&gt;
                          &lt;DataTemplate x:Key="TextBlockTemplate"&gt;
                              &lt;TextBlock/&gt;
                          &lt;/DataTemplate&gt;
                          &lt;DataTemplate x:Key="CheckBoxTemplate"&gt;
                              &lt;CheckBox IsChecked="False"/&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGrid.Resources&gt;
  </code></pre>