I have the following controls embedding (not inheritance, just placing):

Native TextBlock is placed in MyMiddleControl, which is placed in MyGlobalControl. MyMiddleControl has a DependencyPropery "GroupName", which is binded to TextBox.Text. MyGlobalControl has a public property "MyText, which is binded to MyMiddleControl.GroupName.
XAML:
<UserControl x:Class="MyMiddleControl"
...
DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
<TextBlock Text="{Binding Path=GroupName}"/>
</UserControl>
with
public static readonly DependencyProperty GroupNameProperty =
DependencyProperty.Register("GroupName", typeof(string),
typeof(MyMiddleControl),
new PropertyMetadata("default"));
public string GroupName
{
get { return (string)GetValue(GroupNameProperty); }
set { SetValue(GroupNameProperty, value); }
}
and
<UserControl x:Class="MyGlobalControl"
...
DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
<MyMiddleControl GroupName="{Binding MyText}"... />
</UserControl>
with
public string _myText = "myDef";
public string MyText
{
get { return _myText ; }
set { _myText = value; }
}
Problem #1. When I run the program I see "default" in the textblock instead of "myDef".
Problem #2. I have the button which do:
private void TestButton_Click(object sender, RoutedEventArgs e)
{
MyText = "TestClick";
}
The result is the same: "default".
Why? :(
Update:
I forget to say. If I do
<UserControl x:Class="MyGlobalControl"
...
DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
<MyMiddleControl GroupName="FixedTest"... />
</UserControl>
It works fine.
PS. The sample project with changes from the first answer: TestBind.zip.