I want binding Text in Tooltip but i have one problem, it is binding value is other element controls, therefore i cannot basically get their value through binding.
<TextBlock x:Name="txb2" Text="Hello Stackoverflow"/>
<TextBox Grid.Row="1" TextChanged="TextBox_TextChanged">
<TextBox.ToolTip>
<TextBlock>
<Run Text="{Binding ElementName=txb2, Path=Text}" FontWeight="Bold"/>
</TextBlock>
</TextBox.ToolTip>
</TextBox>
basically I tried binding this code.
If you look at the output you will see an error:
You can fix it by using x:Reference:
As for the difference between ElementName and x:Reference take a look at the following thread. ElementName does not work since Tooltip is not a Ui property, but ElementName only works with Ui Element hierarchy (Visual Tree) when it searches txb2.