locked
Using Test Data in DataTemplates

    Question

  • As we all know, it can sometimes be hard to determine exactly what templated controls and DataTemplates will look like until we actually run our code. I have seen features in Blend (and there may be something in Visual Studio as well) for supplying test data, but when I try to use them (which I seem to have trouble doing, but I might just be doing it wrong) they haven't helped me much. Does anybody know of any good sites or blogs on how to use test data to help design templates and make sure they look the way you want? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Saturday, January 10, 2015 1:12 AM

Answers

All replies

  • Typically I use the MVVM pattern when developing xaml applications. The MVVM light framework makes this easy to show design data. You can put the data you want on the screen when you design the app in the DesignDataService which is only used in visual studio and blend
    Saturday, January 10, 2015 5:22 PM
  • I found a great blog for this at:

    http://blogs.msdn.com/b/wpfsldesigner/archive/2010/06/30/sample-data-in-the-wpf-and-silverlight-designer.aspx

    The only thing I couldn't figure out how to do from this is create test data that is a collection (or in my case, a List(Of T)) without defining another type. But I guess that's a small price to pay to allow me to more easily design my templates, especially since I can remove it afterwards.


    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Saturday, January 10, 2015 7:34 PM