自定义控件隐藏在 Expression Blend 中

发布于 2024-10-18 11:54:41 字数 886 浏览 2 评论 0原文

我有以下问题: 我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一抹微笑 2024-10-25 11:54:41

找到解决方案:

问题是项目是在VS中创建的,而不是在blend中创建的。 .csproj 文件不包含该属性:

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

通过添加此属性,现在可以通过 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:

<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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文