System.Windows.Controls在月光下的问题 [英] Problem with System.Windows.Controls in Moonlight
问题描述
我收到此错误消息:
无法解析元素WrapPanel,属性(空),错误:无法解析托管类型WrapPanel
当我的Moonlight应用启动时.
我已经设置了名称空间:
xmlns:basics ="clr-namespace:System.Windows.Controls; assembly = System. Windows.Controls"在我的Xaml顶部,并且有一个参考设置为:
System.Windows.Controls
以下是WrapPanel的定义方式:
< basics:WrapPanel Orientation =垂直"保证金=-2,2,0,0&";背景=白色".名称="RightGridStackPanel"; VerticalAlignment =顶部"高度=自动">
引用该程序集中的任何其他控件时,都会收到类似的错误(如ListView).
我想念什么?
I get this error message:
Could not parse element WrapPanel, attribute (null), error: Unable to resolve managed type WrapPanel
When my Moonlight app starts up.
I have the namespace set up:
xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System. Windows.Controls" at the top of my Xaml and I have a reference set to:
System.Windows.Controls
Here's how the WrapPanel is defined:
<basics:WrapPanel Orientation="Vertical" Margin="-2,2,0,0" Background="White" Name="RightGridStackPanel" VerticalAlignment="Top" Height="Auto">
I get a similar error when referencing any other of the controls that are in that assembly (like ListView).
What am I missing?
推荐答案
嗨Purpleflash,
Hi Purpleflash,
在WPF中,StackPanel和ListView位于程序集PresentationFramework中,因此,如果要定义新的xmlns,则应该类似于以下内容:
xmlns : ="clr命名空间:System.Windows.Controls; assembly = PresentationFramework"
现在,您可以通过以下xmlns使用该控件,如下所示:
In WPF, the StackPanel and ListView are in the assembly PresentationFramework, so if you want to define a new xmlns, it should be something likes the follows:
xmlns:basics="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
Now you can use the control via this xmlns as follows:
< ; 基础 ListView
< : >
<basics:ListView.Items>
< > 您好 </ >
<TextBlock>Hello</TextBlock>
< > Hello2 </ >
<TextBlock>Hello2</TextBlock>
</ 基础 : ListView.Items >
</basics:ListView.Items>
< ;/ 基础 ListView
希望这会有所帮助.
最诚挚的问候,
潘凯文
Best regards,
Kevin Pan
这篇关于System.Windows.Controls在月光下的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!