Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content generated from ContentTemplate does not have DataContext of Silverlight ContentControl set

In my Silverlight 4 application, I have a ContentControl with its ContentTemplate property bound to a property in the data context. That works fine. However, the content of the template once rendered has its DataContext set to null. I would like the content to inherit the same DataContext as set for the ContentControl. Is there a way to get this to happen?

like image 691
Jacob Avatar asked Jul 13 '10 18:07

Jacob


1 Answers

The ContentControl's template has the ContentControl's Content property as a DataContext. So try

<ContentControl Content="{Binding}" />

if this is merely the current DataContext.

like image 115
John Avatar answered Oct 15 '22 23:10

John