Binding in ContentControl Crash
- by ImJames
Can anyone tell me why this crashes my app? There seems to be some endless recursion by I can't figure out why. I get this exception
Logical tree depth exceeded while
traversing the tree. This could
indicate a cycle in the tree
<ContentControl Content="{Binding}">
<ContentControl.ContentTemplate>
<DataTemplate>
<Button Content="{Binding MyString}"/>
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
And this is all I have as Source
public MainWindow()
{
InitializeComponent();
MyString = "Test";
this.DataContext = this;
}
public string MyString { get; set; }