Silverlight DockPanel exception in runtime

I have a DockPanel in a UserControl, and in the designer looks everything fine, but I get an exception in runtime from the InitializeComponent():

The type 'DockPanel' was not found because 'http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit' is an unknown namespace.

Any idea?

<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>

Do you reference the correct System.Windows.Controls.Toolkit.dll assembly in your project? If you're using Silverlight 4, also make sure it's the right version 4 (not 3).

链接地址: http://www.djcxy.com/p/34546.html

上一篇: Silverlight 4工具包中的Windows 7 Phone namspace

下一篇: 运行时Silverlight DockPanel异常