XAML Multi-Level Binding Source/Path Issue

Posted by tpartee on Stack Overflow See other posts from Stack Overflow or by tpartee
Published on 2010-05-05T22:04:46Z Indexed on 2010/05/05 22:08 UTC
Read the original article Hit count: 163

Filed under:
|
|
|
|

So I have this issue I've been trying various ways to tackle all day and nothing's catching and working for it. Basically I have a XAML object called ChromeWindow (derived from Window) which has in it's code-behind a DependencyProperty called AppChrome which stores a reference to an associated ApplicationChrome XAML object (derived from UserControl). ApplicationChrome's XAML file has a few x:Name'd objects (a TextBlock and Border for instance) to which I want to bind to from the ChromeWindow's XAML. The root of the ChromeWindow is x:Name'd as 'rootWindow' in the XAML, so I figured one of these bindings would work:

{Binding ElementName=rootWindow, Path=AppChrome.CaptionTextBlock.Text, Mode=OneWay}

But that complains of a BindingExpression path error such that the property 'CaptionTextBlock' (an x:Name'd TextBlock in AppChrome's XAML) cannot be found on object of type ApplicationChrome

So I tried this binding intead:

{Binding Source=AppChrome.CaptionTextBlock, Path=Text, Mode=OneWay}

And still no luck, this time complaints of a BindingExpression path error again, but this time that it cannot find the 'CaptionTextBlock' property on object of type String

I know I'm missing something really simple here, please help! ;D

© Stack Overflow or respective owner

Related posts about xaml

Related posts about wpf