Custom ContentControl and setting the Model.

Topics: Bugs
Jul 12, 2011 at 5:56 PM

Ok, so either I'm doing something silly, or this is a bug in Caliburn.Micro. I'm still fairly new to the framework so it might be me.

I have a custom ContentControl that I'd like to use instead of the default. When putting it in the View I set the Model attached property just as if it was a standard ContentControl.

<!-- This works fine -->
<ContentControl cal:View.Model="{Binding ChildScreen}" />

<!-- This fails completely -->
<local:MyContentControl cal:View.Model="{Binding ChildScreen}" />

Is there something I need to setup/configure to get custom ContentControls to work in this scenario?


Jul 12, 2011 at 6:56 PM

Does it actually inherit from ContentControl? If not, you need to add a ContentPropertyAttribute to the control. If that doesn't work, see if you can create a simple solution that demonstrates the problem. Create a ticket and attach it and I'll have a look at it.

Jul 13, 2011 at 3:53 AM

I'm using a 3rd party control. Turns out it inherited from a ContentPresenter, not a ContentControl.

Adding the custom presenter to the template of a ContentControl did the trick.