【问题标题】:Silverlight DockPanel exception in runtimeSilverlight DockPanel 运行时异常
【发布时间】:2011-07-29 02:16:36
【问题描述】:

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

【问题讨论】:

    标签: silverlight exception runtime dockpanel


    【解决方案1】:

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

    【讨论】:

    • 我找到了:我只是在 UserControl 项目中引用了这个 dll。但我不明白,为什么会出现这个问题。
    猜你喜欢
    • 1970-01-01
    • 2017-08-03
    • 2014-02-26
    • 2013-04-06
    • 2014-01-14
    • 2017-02-04
    • 2012-03-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多