0

我在 UserControl 中有一个 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>
4

1 回答 1

1

您是否在项目中引用了正确的System.Windows.Controls.Toolkit.dll程序集?如果您使用的是 Silverlight 4,还要确保它是正确的版本 4(不是 3)。

于 2011-04-04T11:08:17.290 回答