Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a new IronPython WPF Window to complains "Window is not supported in a WPF project"

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:

Window is not supported in a Windows Presentation Foundation (WPF) project.

Grid is not supported in a Windows Presentation Foundation (WPF) project.

The XAML window has this innocuous looking code in it:

<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?

like image 861
Nick T Avatar asked Mar 22 '14 18:03

Nick T


1 Answers

The project was started as an "IronPython Windows Forms Application" rather than an "IronPython WPF Application" so it was missing the relevant references:

  • PresentationCore
  • PresentationFramework
  • WindowsBase

Adding them makes WPF forms functional, or just recreating the project.

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?

like image 57
Nick T Avatar answered Oct 02 '22 14:10

Nick T