Visual Studio 2013 Express WPF Deigner load failure

不问归期 提交于 2019-12-13 05:02:12

问题


I have troubles with my VS2013 Express Wpf Designer. He won't load the views in wich I use Custom converters. The application compile and run fine and my converters work as expected. But in design mode, I keep getting "The name {converterClassName} does not exist in the namespace {namespace}"

Thing is, while I don't use the designer to create the view, I use it to have an idea of what I am doing will look like without having to debug, so I'll be super glad if it could work again.

Global View :

(Pardon my Frenchiness)


Details :

I reference my namespace (wich belongs to the same assembly than the view this way :

<UserControl xmlns:converters="clr-namespace:Sequenceur.ProdUI.IHM.Converters">

Declare the ressource this way :

<UserControl.Resources>
    <converters:BoolToVisibility x:Key="visibilityConverter"/>
</UserControl.Resources>

(The problem is the same with a Window)

And use my converter this way :

<MenuItem Header="Maintenance" Visibility="{Binding Path=AdminMode, Converter={StaticResource ResourceKey=visibilityConverter}}">

The converter itself

It's a simple IValueConverter realization, nothing fancy.

In all my other projects, the designer load just fine even with converters. You may like to know that I have made some dirty copy/past with my view from an other project, it must come from that, but i can't see where...


回答1:


I have had similar problems with VS 2012, for converters as well as for resources from resx files. I'm afraid I don't have a solution that works every time, but inspiring myself from similar questions such as this one and this one, I usually switch between solution configuration "Debug 86" and "Debug Any CPU" a couple of times, cleaning and rebuilding till the problem goes away (it doesn't always works the first time).

If that doesn't work, the answers in the above link mention other solutions which I haven't personnaly tried, including adding the assembly information to the clr-namespace or changing the output path.

I have also seen the solution which consists of creating a new project to get rid of the error but as these errors tend to be recurring, it is a temporary solution only (and an annoying one at that, especially when working with source control).




回答2:


Fighting with Visual Studio designer is very common, in my case especially. Sometimes I'm on the edge of madness and that's the reason why I prefer only code view and not using designer (but of course, designes has some advantages). But in your case, these steps should help :

  1. rebuild solution (BoolToVisibility is maybe not built)
  2. close your XAML file
  3. try to clean and rebuild second time
  4. open your XAML file

Maybe it won't help. Sometimes restarting of the Visual Studio can solve some of these issues as well.



来源:https://stackoverflow.com/questions/26275032/visual-studio-2013-express-wpf-deigner-load-failure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!