How can I forcefully create an object declared in resources

I declare an object in XAML (under UserControl.Resources) like this:

<vm:ErrorDisplayService x:Key="EDSvc"/>

      

My object's constructor is not being called.

I can get it to work if I put a mock object like this:

<TextBlock Visibility="Collapsed" Text={StaticResource EDSvc}/>

      

but that seems like a hack to me.

Is there a cleaner way to do this?

JAB

+3


source to share





All Articles