views:

15

answers:

1

I'm looking for a way to gain reference to a class that was instanciated via XML, but I need reference to it in imperative code. I usually do this via the datacontext of the control, but in this case, the user control does not have declaritive reference to the class that I require.

I know I have seen how to gain a reference to a class instanciated via the User.Resources, or Application.Resources - I just can't seem to put the right key words together and find an example!

R

A: 

So after digging for awhile, I came across the Application.Current static method that returns the Application class - which does read the App.XML and has reference to entities instanciated via XML.

The trick was to cast the Application class to the App class before you are able to see the resources that were instanciated via the XML.

After 20 years of imperative programming, I'm finding this declarative interaction painful.

codputer