Silverlight DockPanel 运行时异常
我在 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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否在项目中引用了正确的 System.Windows.Controls.Toolkit.dll 程序集?如果您使用的是 Silverlight 4,还要确保它是正确的版本 4(而不是 3)。
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).