J'ai des problèmes de liaison dans wpf/xaml. Avoir ce simple fichier:WPF Liaison simple à une propriété d'objets
<Window x:Class="test.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<TextBlock Height="21" Foreground="Black" Margin="74,98,84,0" Name="textBlock1" VerticalAlignment="Top" Text="{Binding MyText}" />
</Grid>
</Window>
Où je veux lier le contenu du bloc de texte à ma propriété "MyText". Mon code ressemble à ceci:
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
public string MyText
{
get { return "This is a test"; }
}
}
Dans l'ensemble très simple, mais quand je commence le textblock n'a pas de contenu - howcome?
MISE À JOUR: Je ne même pas un point d'arrêt à la propriété – H4mm3rHead