WPF MVVM XAML 设计 - VS 2010 XAML 设计器 - 设计时数据 [英] WPF MVVM XAML design - VS 2010 XAML designer - Design time data
问题描述
我们正在开发 WPF 应用程序.我们已将视图的开发委托给使用 VS 2010 XAML 设计器进行设计的设计人员.我们已经进入了 MVVM 模式.我们期待 XAMl 设计人员设计屏幕/视图,并基于屏幕我们将开始构建 ViewModel.但是设计人员在查看没有设计时数据的视图布局时遇到了问题.有没有办法解决这个问题?
We are in the process of developing a WPF app. We have entrusted the development of the Views to designers who would use VS 2010 XAML designer to design. We have gone in for MVVM pattern. We are expecting the XAMl designers to design the Screens/Views and based on the screens we will start constructing the ViewModel. But the designers are having a problem viewing the layout of views without design time data. Is there a way to solve this?
推荐答案
您可以遵循以下指南:
- Blend、VS2010 和 WPF/Silverlight 中的 DesignData MVVM 支持
- d:DesignInstance, d:DesignData在 Visual Studio 2010 Beta2 中
您开始向 XAML 文件添加以下命名空间声明:
You start adding the following namespace declarations to your XAML files:
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
您可以设置在运行时忽略的属性和属性.
The you can set properties and attributes that are ignored at runtime.
例如,d:DataContext
使您能够设置独立于运行时 DataContext<的设计时
d:DataContext
/代码> 属性.
For example, d:DataContext
gives you the ability to set a design time d:DataContext
that is separate and independent from the run-time DataContext
property.
这篇关于WPF MVVM XAML 设计 - VS 2010 XAML 设计器 - 设计时数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!