下面的XAML產生XamlParseException
在運行時:WPF baml序列化錯誤?
<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: '上缺少關鍵值 'TextBlock的' 對象'。行號「10」和行位置「20」。
我在做什麼錯?
您是否使用XamlReader.Parse?如果是這樣,它在XamlPadX中工作嗎?如果是這樣,[這個問題](http://stackoverflow.com/q/6850713/21475)可能有關係。 – Cameron
我只是用上面的XAML作爲主窗口運行應用程序:) – ControlFlow