开发者

custom controls are hidden in Expression Blend

I have the following problem: I'm coding a C# WPF application in Visual Studio 2010. I'm making use of the MVVM pattern and thus have several views (with xamls) that look like this:

<base:ViewBase x:Class=blablabla>
<!-- here is all the nice xaml code -->
</base:ViewBase>

My code-behind files look like this:

public partial class LogView : Infrastructure.BaseClasses.ViewBase, ILogView
{
  // code here
}

The class ViewBase inherits from UserControl.

Now the Visual Studio 2010 preview of the xaml file works perfectly fine and I can edit the controls in the view.

However, now I would like to open the project in Expression Blend 3 to edit the design. Expression Blend only shows the xaml file but not the preview.

How is it possible to show the preview as well? and edit it properly.

I found this question Expression Blend Forcing User Controls to be hidden, but their solut开发者_运维技巧ion is to temporarily make the control a UserControl. This is a workaround that may work, but comes with some extra work since every time I would like to compile, I would have to change it back! Is there a smooth way to make Expression Blend show the preview?

Best wishes, Christian


Found the solution:

The problem is that the project has been created in VS and not in blend. The .csproj file does not contain the attribute:

<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

By adding this property, the project can now be opened both by VS2010 and Expression Blend. The first guid states that the project is a WPF project, the second guid states that it is also a windows c# project. For a list of guids see: link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜