Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This in fact is a bug in the framework. Adding the local name space through the XmlnsDictionary wouldn't work. It has to be added within the template definition with the assembly and namespace defined: </p> <p>as in the comment above by @Nerd In Training this should work: </p> <pre><code>string statRowTemplate = "&lt;DataTemplate &gt;"; private DataTemplate GenerateStatRowDataTemplate() { ParserContext pc = new ParserContext(); pc.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation"); pc.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml"); pc.XmlnsDictionary.Add("xcdg", "http://schemas.xceed.com/wpf/xaml/datagrid"); string statRowTemplate = "&lt;DataTemplate xmlns:local=\"clr-namespace:MyTest;assembly=MyTest\" &gt;&lt;xcdg:StatRow&gt;"; statRowTemplate += "&lt;xcdg:StatCell FieldName=\"Column4\" ResultPropertyName=\"AvgColumn4\"&gt;"; statRowTemplate += "&lt;xcdg:StatCell.ContentTemplate&gt;"; statRowTemplate += "&lt;DataTemplate&gt;"; statRowTemplate += "&lt;TextBlock Text=\"{Binding ., Converter={StaticResource ResourceKey=myConverter}}\" /&gt;"; statRowTemplate += "&lt;/DataTemplate&gt;"; statRowTemplate += "&lt;/xcdg:StatCell.ContentTemplate&gt;"; statRowTemplate += "&lt;/xcdg:StatCell&gt;"; statRowTemplate += "&lt;/xcdg:StatRow&gt;"; statRowTemplate += "&lt;/DataTemplate&gt;"; StringReader stringReader = new StringReader(statRowTemplate); XmlReader xmlReader = XmlReader.Create(stringReader); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(statRowTemplate.ToString())); DataTemplate dt = (DataTemplate)XamlReader.Load(ms,pc); dt.LoadContent(); return dt; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload