Immediately after adding a brand new, untouched WPF window to my IronPython 2.7 project in VS2013 (with Python Tools for VS 2.0.11016), it tells me "Invalid Markup" in the design window, and the error list shows:
在VS2013(使用Python Tools for VS 2.0.11016)的IronPython 2.7项目中添加一个全新的,未触及的WPF窗口后,它立即告诉我设计窗口中的“无效标记”,错误列表显示:
Window is not supported in a Windows Presentation Foundation (WPF) project.
Windows Presentation Foundation(WPF)项目不支持窗口。
Grid is not supported in a Windows Presentation Foundation (WPF) project.
Windows Presentation Foundation(WPF)项目不支持网格。
The XAML window has this innocuous looking code in it:
XAML窗口中有这个看似无害的代码:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
</Grid>
</Window>
Does Python tools for VS not really support form creation? Did I forget to configure something?
VS的Python工具不是真的支持表单创建吗?我忘了配置一些东西吗?
1 个解决方案
#1
14
The project was started as an "IronPython Windows Forms Application" rather than an "IronPython WPF Application" so it was missing the relevant references:
该项目是作为“IronPython Windows Forms应用程序”而不是“IronPython WPF应用程序”启动的,因此它缺少相关的引用:
- PresentationCore
- PresentationCore
- PresentationFramework
- PresentationFramework
- WindowsBase
- WindowsBase
Adding them makes WPF forms functional, or just recreating the project.
添加它们可以使WPF表单起作用,或者只是重新创建项目。
If all of those references appear to be in the project, removing/readding some might help. Another user reported he had to do so for 'PresentationFramework'; perhaps there's a couple that have the same name?
如果所有这些引用似乎都在项目中,删除/读取一些可能会有所帮助。另一位用户报告他必须为“PresentationFramework”这样做;也许还有一对有同名的人?
#1
14
The project was started as an "IronPython Windows Forms Application" rather than an "IronPython WPF Application" so it was missing the relevant references:
该项目是作为“IronPython Windows Forms应用程序”而不是“IronPython WPF应用程序”启动的,因此它缺少相关的引用:
- PresentationCore
- PresentationCore
- PresentationFramework
- PresentationFramework
- WindowsBase
- WindowsBase
Adding them makes WPF forms functional, or just recreating the project.
添加它们可以使WPF表单起作用,或者只是重新创建项目。
If all of those references appear to be in the project, removing/readding some might help. Another user reported he had to do so for 'PresentationFramework'; perhaps there's a couple that have the same name?
如果所有这些引用似乎都在项目中,删除/读取一些可能会有所帮助。另一位用户报告他必须为“PresentationFramework”这样做;也许还有一对有同名的人?