This probably won't affect any of you, but just to add to this I found a similar issue with a WPF Blend Add-in. IsInDesignTool was returning true at runtime. Which sort of makes sense (but still wrong), since I was still 'inside of the design tool'. Anyway, I never bother debugging it and just went with a SampleData ViewModel approach...
On Wed, Aug 18, 2010 at 4:37 AM, Peter Blois <[email protected]> wrote: > +1 to IsInDesignTool- HtmlPage.IsEnabled was the workaround from > Silverlight 2 ages, it will generate false positives when running out of > browser (and other scenarios). > > > > Pete > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Peter Gfader > *Sent:* Monday, August 16, 2010 11:25 PM > *To:* ozSilverlight > *Subject:* Re: Design time data > > > > +1 to > > if (DesignerProperties.IsInDesignTool) > > { > > // create sample data for designer > > } > > > > > > > > > > On Tue, Aug 17, 2010 at 4:02 PM, Miguel Madero <[email protected]> > wrote: > > We have to be careful with HtmlPage.IsEnabled. That was the way to do it in > Silverlight 2, however this will break Out of Browser. Not a big issue if > you don't care about OOB, but just something to keep in mind. > > > > Try DesignerProperties.IsInDesignTool. This should work for both VS and > Blend. > > > > @David, there are a couple more options > > > > 1. Create Sample Data from class option in Blend. To be honest I don't like > it and find it quite limited, but it's still an option. > > 2. Using a DesignTime ViewModel. Using a d:DataContext and set it to create > an instance of your type. > > > > > > On Tue, Aug 17, 2010 at 3:32 PM, ross <[email protected]> wrote: > > Hi David, > > I've sent this directly to you, as you can't send attachments to the > list. I'm a bit short of time to write an essay, so just drummed up a > sample. > > The sample isn't the only way to do it, but maybe will give you some ideas. > > The key is the check for if (HtmlPage.IsEnabled), where the service > locator sets the mock data if false. When in blend, > HtmlPage.IsEnabled = false. Of course, you can do this where ever you > want in your code base. You don't necessarily have to use a service > locator, or set the datacontext in the same manner. > > If you open the project in blend, you will see the data displayed is > all mock data. If you run it from VS you will see 'live' data. Of > course the live data is a fudge in this case but should give you the > idea. > > Let me know if you have any questions. > > Cheers. > > Ross > > > On Tue, Aug 17, 2010 at 12:23 PM, David Burela <[email protected]> > wrote: > > Thought I'd check how others are displaying design time data. There are 2 > > ways that I go about it > > 1. > > Just setting the design time datacontext to a sampledata.xaml file > > <grid d:Datacontext={SamleData.Xaml}> > > > > 2. > > Doing it similar to how Jordan shows in his presentations > > View > > ViewModel > > Repository (Runtime, DesignTime, etc) > > (RVVM) > > > > The first option is nice and quick and easy to do, but it doesn't help > you > > unit test your ViewModel at all. > > The 2nd option is good, but as far as I know depends on your ViewModel > > loading the data in the constructor. > > I am at a client where they load the data up as a seperate call, not in > the > > constructor. Any tips on how I could still use the repository pattern, > but > > still be able to load the data without anything in the constructor. > Doesn't > > seem possible to me. > > -David Burela > > > _______________________________________________ > > ozsilverlight mailing list > > [email protected] > > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > > > > > > _______________________________________________ > ozsilverlight mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > > > -- > Miguel A. Madero Reyes > www.miguelmadero.com (blog) > [email protected] > > > _______________________________________________ > ozsilverlight mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > > > > -- > > > > .peter.gfader. > > http://blog.gfader.com/ > > http://twitter.com/peitor > > > > > > _______________________________________________ > ozsilverlight mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > -- Miguel A. Madero Reyes www.miguelmadero.com (blog) [email protected]
_______________________________________________ ozsilverlight mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
