1

The following XAML produces XamlParseException in runtime:

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <Grid>
    <Grid.Resources>
      <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
          <ResourceDictionary>
            <TextBlock x:Key="{x:Type TextBlock}">
              <Run Text="Aaaa"/>
            </TextBlock>
          </ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
        <sys:String x:Key="aaa"></sys:String>
      </ResourceDictionary>
    </Grid.Resources>
    <Border Child="{StaticResource {x:Type TextBlock}}"/>
  </Grid>
</Window>

XamlParseException: 'Missing key value on 'TextBlock' object.' Line number '10' and line position '20'.

What am I doing wrong?

controlflow
  • 6,667
  • 1
  • 31
  • 55

1 Answers1

-1

Keys can't be types, they're strings.

Joel Lucsy
  • 8,520
  • 1
  • 29
  • 35