自定义控件隐藏在 Expression Blend 中
我有以下问题: 我正在 Visual Studio 2010 中编写 C# WPF 应用程序。我正在使用 MVVM 模式,因此有几个如下所示的视图(带有 xaml):
<base:ViewBase x:Class=blablabla>
<!-- here is all the nice xaml code -->
</base:ViewBase>
我的代码隐藏文件如下所示:
public partial class LogView : Infrastructure.BaseClasses.ViewBase, ILogView
{
// code here
}
ViewBase 类继承自用户控制。
现在,xaml 文件的 Visual Studio 2010 预览工作得很好,我可以在视图中编辑控件。
但是,现在我想在 Expression Blend 3 中打开项目来编辑设计。 Expression Blend 仅显示 xaml 文件,但不显示预览。
怎么才能同时显示预览呢?并正确编辑它。
我发现这个问题 Expression Blend Forcing User Controls to be隐藏,但他们的解决方案是暂时将控件设为UserControl。这是一种可能有效的解决方法,但会带来一些额外的工作,因为每次我想编译时,我都必须将其改回来!有没有一种流畅的方法可以让 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 solution 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到解决方案:
问题是项目是在VS中创建的,而不是在blend中创建的。 .csproj 文件不包含该属性:
通过添加此属性,现在可以通过 VS2010 和 Expression Blend 打开该项目。
第一个 guid 表明该项目是一个 WPF 项目,第二个 guid 表明它也是一个 windows c# 项目。有关指南列表,请参阅:链接
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:
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