Hi,
I have a UserControl: PlayerInformation.xaml
<Canvas x:Name="LayoutRoot" Background="Black">
<TextBlock x:Name="TxtBlPlayerName" Text="{Binding PlayerName}"
Foreground="#FF8D7204" FontSize="10.667" Width="225" Height="15"
ToolTipService.ToolTip="{Binding PlayerInformationNameDescription, Source={StaticResource Lang}}" />
</Canvas>
This control has a DP:
public string PlayerName
{
get { return (string)GetValue(PlayerNameProperty); }
set { SetValue(PlayerNameProperty, value); }
}
// Using a DependencyProperty as the backing store for PlayerName. This enables animation, styling, binding, etc...
public static readonly DependencyProperty PlayerNameProperty =
DependencyProperty.Register("PlayerName", typeof(string),
typeof(PlayerInformation), new PropertyMetadata(OnPlayerNameChange));
<br/>
Can you please explain me how to bind this DP with the TextBlock in XAML ?
i try: Text="{Binding PlayerName}" but doesn't work, maybe i need an ElementName?
In code, i try with the callback event ... but i want a cleanner way.
Thx.