Hello,
I am trying to do some simple binding to a property inside my usercontrol. Does anyone know why this doesn't work? It works when the TextBlock is outside the Tooltip.
Thanks!
MasterPage.cs:
MyUserControlInstance.DisplayName = "Test";
MyUserControl.xaml
<ToolTipService.ToolTip>
<ToolTip Template="{StaticResource ToolTipTemplate}">
<StackPanel>
<TextBlock Text="{Binding ElementName=UserControl, Path=DisplayName}" />
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
MyUserControl.cs
public static DependencyProperty DisplayNameProperty = DependencyProperty.Register("DisplayName", typeof(string), typeof(MyUserControl));
public string DisplayName
{
get { return (string)GetValue(DisplayNameProperty); }
set { SetValue(DisplayNameProperty, value); }
}