Empty key in DataTemplateDictionary

According to your documentation the default node template in DataTemplateDictionary has key of empty string. The problem is that this generate a warning during XAML parsing.

Is it possible to have different value for default.

I can create a MarkupExtension that simply return empty string from the GetValue if not.

Thank you,

Try setting the DataTemplateDictionary.Default property instead, for that particular dictionary entry.

But <span =“Apple-style-span” style=": rgb248, 248, 252; ">DataTemplateDictionary.Default is of type DataTemplate and I need to set key of type String, usually.

Take a look at Table.xaml:

<go:DataTemplateDictionary x:Key="NodeTemplateDictionary" Default="{StaticResource NodeTemplate}" />

Now the demo was constrained to be compatible with Silverlight 3, so the XAML is not completely defining the DataTemplateDictionary in XAML but partly in code.

For Silverlight 4 and WPF, you can move the other DataTemplate definitions into the DataTemplateDictionary in XAML:

[code] <go:DataTemplateDictionary x:Key=“NodeTemplateDictionary” Default="{StaticResource NodeTemplate}">

  <DataTemplate x:Key="Area">
    <Border Background="Black" Padding="2 0 2 0" go:Part.Selectable="False">
      <TextBlock Text="{Binding Path=Data.Text}" Foreground="White" />

And of course you can remove the corresponding DataTemplateDictionary initializing code in the code-behind.

Thanks, that works great. I misunderstand the Default property you refer.