PDA

View Full Version : How much code can be run while designing?



Gazman
September 15th, 2009, 02:06 AM
(Using Expression Blend 3 and Visual Studio 2008 express)

I gather that the code in the constructor of a class is run when that class is instantiated from xaml, but how far can you go?

What if that constructor instantiated another class which ran methods in it's constructor?

What are the rules?

I'm thinking out loud here, but say I am designing a UI for a piece of external hardware connected by some protocol/library which takes the data from the device and stores it as dependency properties in memory. Can I have the code that is needed to get the data off the hardware running while I am designing?

That "Add live data source" button on the Data tab looks promising but I don't know...

kirupa
September 15th, 2009, 03:26 AM
Hi Gazman - for the most part, almost everything is run. There may be some animation-related things that we suppress, but you can have a nested class that controls some UI on a grandparent class, and Blend will happily show you the results of it.

Let me know if you are running into any limitations.

:)

Gazman
September 15th, 2009, 07:08 AM
Thanks Kirupa,
Just to make sure we don't have our wires crossed... I am talking about running code in the background while designing. Is that how you understood my question? Does your answer still apply?

Sorry but I just reread my question and realized it was not very clear.

kirupa
September 17th, 2009, 12:45 AM
Yep - we are talking about the same thing :)