For my example let's say I have this in my DataContext :
public object SomeProperty
{
get;
set{ ....
PropertyChanged(....);
}
}
XAML :
<ContentControl Tag="{Binding SomeProperty}" x:Name="myContentControl" />
Now in my DataContext
I need to reference myContentControl
.
Is there any way through the Binding object created to resolve the binding Target (ContentControl.TagProperty) through the Binding Source (MyViewModel.SomeProperty)?
Question Context :
I have a CustomControl Deriving from DataGrid , this grid supports Filtering throw the header , inside the header template i placed a TextBox . The grid itself listens to TextChanged event and filters each column by that text .
Instead of saving a reference to each TextBox , or alternatively traversing the VisualTree I was wondering if i could track the TextBox from the reference i saved to textBox.Text.
var filterValue = textBox.Text;
values.Add(source,filterValue); // Dictionary
tow questions come to mind :
1) Because Text is a string and there for immutable i'm not sure how binding keeps track of it .
2) Is it possible to resolve the Binding Target from the Binding Source (Path) ?