Search code examples
c#wpfvisual-studiowpf-controlsvisual-studio-designer

VS 2017 XAML Designer View not Rendering Custom/User Control in One Solution but Will in New Ones


I have a WPF solution which at some point the design viewer stopped properly rendering a custom control I wrote and the LiveCharts Cartesian Chart which is a user control, I believe. To be clear, when add either these controls to a page in the XAML Designer the controls are there but invisible - i.e. not rendered. You can select the controls and see the bounding rectangle, but you can't see the actual control. If I run the application the controls are rendered properly and usable at run time...they just don't show up in the XAML designer view.

If I create an entirely new solution/project, then both controls show up just fine in designer view. However, if I add a project to the solution in question, I get the same invisibility issue.

I have compared the solution/project's and I can not find any differences. Obviously I did something to the original solution that must have caused this, but I can not figure out what or how to fix it.

Has anyone seen this or have any ideas of what to look for to fix it?


Solution

  • If your WPF part is in separate assembly, then you can set its platform to AnyCPU leaving entry assembly and p/invoke ones x64. This will allow you to keep XAML editable and your external code working.