问题
We are trying out Visual Studio 2008 and Expression Blend on a new project. The goal is to clearly define the role of the developer and designer as separate, but reap the benefit of the developer being able to directly consume the XAML produced by the designer.
For the most part this has worked great, and I really like the possibilities. One difficulty we have come across though is designing against DataBindings. In many cases, the GUI does not populate rows, or other data structures unless the application is run, and a database call is made. Consequently the designer does not have access to the visual layout of the GUI.
What I would like to do, is somehow create some simple stubbed or mocked data that the designer can use to work on the design. The big goal is to have that stubbed data show up in Expression Blend, but then be applied to the real collection at runtime.
Has anyone found a solid method of doing this?
回答1:
I would suggest reading this blog. The final method seems to work well, your test data shows up in Blend very nicely. Just keep in mind that you have to compile the DLL before it will display the data.
回答2:
I would look into creating XML data islands which emulate the structure of the objects you will eventually bind the UI to. This way your designer can bind the root element of the page (or user control, etc.) to the top level of your fake XML data island and all the relative paths will stay the same when you swap that data island out for the real DataContext binding.
there will be some degree of refactoring to attach to the real object when you are ready, but that is why your developers should at least know enough XAML to know how to modify the bindings properly.
it looks like the commenter above me has a link to an example of this.
来源:https://stackoverflow.com/questions/66486/how-do-i-stub-data-for-designers-when-using-expression-blend-and-visual-studio