Namek Dev
a developer's log

WPF/Silverlight Design Data without XAML

February 19, 2014

Here’s a class for our sample data. That’s where the data should go into.

public class MainViewModelDesignData : MainViewModel {
    public MainViewModelDesignData() {
        // TODO: instantiate your sample data

In App.xml define your namespace:


and then:

    <models:MainViewModel x:Key="DesignDataContext" />

The last step - instantiate sample data as DesignContext. You can do it in your Window, Page or whatever. I did it in MainPage.xaml in my Windows Phone 7 application:

    <models:MainViewModelDesignData />

Our sample data is bound to whole page. Use it like every other binding.

comments powered by Disqus