Author: Kevmeister | Posted on: 6/6/2008 5:18:43 AM | Views : 506

Lets say that I have:

<Grid>
  <Grid.Resources>
    <myns:MyNonVisualClass x:Key="Fred">
  </Grid.Resources>
  <myns:MyControl MyProperty="{StaticResource Fred}"/>
</Grid>

so that MyNonVisualClass implements IMyInterface, and MyControl.MyProperty is of type IMyInterface.

Unless my error is due to something else, I don't seem to be able to make this assignment this way - taking a far-fetched guess because MyProperty expects IMyInterface, but is being given a MyNonVisualClass, even though MyNonVisualClass implements IMyInterface.

The "MyProperty" is implemented as a Dependency Property, if that makes a difference. 

Is there any way around this - or perhaps I'm doing something wrong altogether?

 
...

Go to the complete details ...