tags:

views:

67

answers:

0

I'm using the new d:DesignInstance feature of the 4.0 series WPF tools. Works great!

Only issue I'm having is: how can I set properties on the instance? Given something like this:

<Grid d:DataContext="{d:DesignInstance plugin:SamplePendingChangesViewModel, IsDesignTimeCreatable=True}"/>

How can I set properties on the viewmodel, aside from setting them in its default ctor or routing it through some other object initializer?

I gave this a try but VS gives errors on compile "d:DataContext was not found":

<Grid>
    <d:DataContext>
        <d:DesignInstance IsDesignTimeCreatable="True">
            <plugin:SamplePendingChangesViewModel ActiveTagIndex="2"/>
        </d:DesignInstance>
    </d:DataContext>

For the moment I'm going back to using a resource and 'd:DataContext={StaticResource SampleData}', where I can set the properties in the resource.

Is there a way to do it via a d:DesignInstance?