Reputation: 14902
I want to show information of a child control of a ContentControl. The ContentControl finds the child control using caliburns view model binding as follows:
<ParentControl>
<ContentControl cal:View.Model="{Binding Path=CustomInput, Mode=TwoWay}" />
</ParentControl>
E.g. in the case where this custom input would bind to an InputTextBoxView
, I want to show its info message in the parent control.
Something like
<ParentControl InfoMessage="{Binding RelativeSource to dependency property of MessageProperty in child element of ContentControl ....}">
<ContentControl cal:View.Model="{Binding Path=CustomInput, Mode=TwoWay}" />
</ParentControl>
Is this in any way possible?
Upvotes: 1
Views: 379
Reputation: 169160
If you give the ContentControl
a Name
, you can bind to a property of the CustomInput
model using the Content
property:
<ParentControl InfoMessage="{Binding Content.ModelProperty, ElementName=cc}">
<ContentControl x:Name="cc" cal:View.Model="{Binding Path=CustomInput, Mode=TwoWay}" />
</ParentControl>
...but you cannot bind to a property of the resolved view for CustomInput
.
Upvotes: 1