2

I would like to show design time data in Blend. I am using Template10 (from Hamburger base project) and I can't see design time data.

From this base project, I would like some help to display the design time data for the variable named "Value".

Thanks!

Samuel

1
  • You can use a feature of the MVVMLight if you use it as a MVVM library. It is a pity that the Template10 ViewModelBase do not implement ant feature like the GalaSoft.MvvmLight.ViewModelBase.IsInDesignModeStatic ... I hope it will do in next releases. See the article blog.qmatteoq.com/the-mvvm-pattern-design-time-data and github.com/qmatteoq/MSFest-Samples Tempolate10Sample .... for the time being you have to use the ViewModelLocator with the dependency injections and IsInDesignModeStatic available in the GalaSoft library even though you use the Template10 ViewModelBase Commented Apr 5, 2016 at 10:13

1 Answer 1

2

Designtime data is accomplished, typically, by loading view-model properties with sample data in the constructor of the view-model. If you are using the T10 project template, then there is already a placeholder where you can add this.

public MainPageViewModel()
{
    if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
    {
        Value = "Designtime value";
    }
}

Best of luck.

2
  • 1
    It's worth mentioning that the Compiler will strip this out of Production, too. So that's a nice side-benefit. Commented Mar 21, 2016 at 20:48
  • Hi Jerry Nixon, Thanks for reply. I think I had a problem in my environment but now it works ! Commented Mar 25, 2016 at 14:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.