2011-04-04 29 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