This project has moved. For the latest updates, please go here.

Design time data in Blend

May 1, 2012 at 5:55 AM

I have opened Chapter14ToDoListPrinting and can see the design time data in VS2010 for TaskGrid.xaml.  But if I open TaskGrid.xaml in the Blend 5 preview I don't see the sample data.  Is there a way to create sample data once (I like the idea of having separate design-time VMs) but be able to see it when using either the VS designer or Blend?

 

Coordinator
May 1, 2012 at 9:41 AM

Most design-time data should appear in both. I'll have to check that specific example but most of the design-time processing should work the same in Blend and Cider. Are you getting any exception when you load the control?

May 1, 2012 at 11:06 AM

Seems like it might be a known problem

http://social.expression.microsoft.com/Forums/ro-RO/blend/thread/b91286c2-c97f-4ca1-84c8-99fa144e3b8e#5d345518-1094-40f0-bfd3-c49e3d156fd0

May 1, 2012 at 11:32 AM

I have found a workaround, if anyone else bumps into this issue.  Declare the DesignTaskGridReportViewModel as a resource and then bind to that

<UserControl.Resources>
   <SampleData:DesignTaskGridReportViewModel 
         x:Key="ReportDesignData"/>
</UserControl.Resources>

and then
<Grid x:Name="LayoutRoot" 
         Background="White" 
         Width="768" 
         Height="1120"
         d:DataContext="{StaticResource ReportDesignData}">

This seems to work in both VS2010 and Blend5 preview.

Coordinator
May 1, 2012 at 12:24 PM

Paul,

Just wanted to say I appreciate all of your help and efforts with looking into these items - I know it is especially helpful to other readers who may have encountered similar issues. Thanks for sharing your solutions here and for all of your feedback!

May 2, 2012 at 2:27 AM

I just want to add that other visitors to this forum should not get the impression that there are problems with the book.  It is just that I don't post when there are three crystal clear explanations on every page and one great insight every 5 pages.  The great bits far, far outnumber the trivial problems.  The problems that I have bumped in to are truely minor and should not discourage anyone from getting a copy of this book.