2011-04-04 106 views
0

Silverlight的DockPanel中例外,我有一个DockPanel中的用户控件,并在设计师看起来一切都很好,但我得到的运行时异常从在InitializeComponent():在运行时

类型“DockPanel中”未找到因为'http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit'是一个未知的命名空间。

任何想法?

<UserControl x:Class="Controls.PropertiesControl" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:my="clr-namespace:Controls" 
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    mc:Ignorable="d" 
    d:DesignHeight="250" d:DesignWidth="800" 
    > 

    <Grid x:Name="LayoutRoot" Background="White"> 
     <Grid> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="30"/> 
      </Grid.RowDefinitions> 

      <toolkit:DockPanel Background="Gray" Grid.Row="0" Grid.Column="0" /> 
     </Grid> 
    </Grid> 
</UserControl> 

回答

1

你引用正确System.Windows.Controls.Toolkit.dll装配在您的项目?如果您使用Silverlight 4,请确保它是正确的版本4(不是3)。

+0

是的,我有一个与正确版本的DLL的参考。 – Aaaaaaaa 2011-04-04 11:28:20

+0

我找到它了:我在UserControl项目中引用了这个dll。但我不明白,为什么会出现这个问题。 – Aaaaaaaa 2011-04-04 11:52:48