Skip to content

Internal Mailbag: How to work with sample data in Blend/Cider

October 10, 2007

Internal mail that may be helpful to the WPF community, read bottom to top…if you have good tips (or feedback) in this area, please let us know…

———————————————————————

From: Blend Program Manager

If you are using ObjectDataProvider, use the GetInDesignMode flag to figure out when you code in running inside Blend/Cider, and change the behavior from run-time to design-time data.

Look at System.ComponentModel.DesignerProperties.GetInDesignMode()

———————————————————————

From: Microsoft User of WPF
Subject: Best way to have test data show up in blend but not at runtime?

I’m sure this has been asked before, but what is the best way to allow a designer to work with real clr data in blend without having to run the application to see the results of his edits?  I’ve been using an object source for blend:

<Window.Resources>

        <ObjectDataProvider x:Key="InstancesDS" d:IsDataSource="True" ObjectType="{x:Type ItemsControlTest:InstancesTestData}"/>

</Window.Resources>

But when I run the app, I want programmatically generate data to show up.  Any way clean way to do this without writing a bunch of custom login in OnLoaded that changes datasources and datacontexts?

Generally how do people deal with this problem?

From → Tools

One Comment
  1. Corrado permalink

    Hi Rob,
    Here\’s an interesting article about design time data
    http://www.galasoft.ch/mydotnet/articles/article-2007091401.html
     
    I personally think that Blend\’s weak area is that in order to easily create a DataTemplate you must use an ObjectDataProvider when in *real* applications this is not always possible (imagine data coming from a DB query…).I\’d love to have a better support in term: Here\’s the type, help me design the template around it.
     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: