【发布时间】:2013-11-29 08:07:20
【问题描述】:
我在将样式应用于自定义类型时遇到了问题。在下面的代码中。我制作了一个名为“MyListView”的扩展列表视图类型,它是从 Inventory.Interface 引用的。 为此创造了风格。它在调试时间完美显示。但是在运行时它会显示这样的错误
'未能从文本'man:MyListView' 创建'Type'。'行号“8”和行位置“12”。
为什么会来,这是怎么回事。
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:src="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:man="clr-namespace:Inventory.Interface"
>
<Style TargetType="{x:Type man:MyListView}">
<Setter Property="BorderBrush" Value="#FFDFDFE2"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="#faf2f2"/>
</Style>
</ResourceDictionary>
【问题讨论】:
-
您的类型
MyListView是否存在于其他程序集中?如果是这样,请指定程序集。例如xmlns:man="clr-namespace:Inventory.Interface;assembly=MyOtherAssembly"。以及“完美地显示调试时间”是什么意思。但是在运行时...'?你的意思是编译时间而不是调试时间? -
非常感谢......它正在工作......
-
发布解决方案(对您有用)作为答案。
标签: .net wpf wpf-controls wpf-4.0