[WPF] Problème de binding + validation
Bonjour
J'ai un problème de binding.
En suivant un exemple j'ai commencé par :
Code:
1 2 3 4 5 6 7 8 9
|
CRReportBO report = new CRReportBO();
report.pTitle = "test";
//...
Binding bindingReport = new Binding();
bindingReport.Source = report;
bindingReport.Path = new PropertyPath("pTitle");
re_title.SetBinding(TextBox.TextProperty, bindingReport); |
et dans mon XAML :
Code:
<TextBox Name="re_title"/>
Jusque là, ça fonctionne.
Puis j'ai vu qu'on pouvait faire cela plus simplement depuis le XAML.
j'ai donc supprimé le code précédemment écrit, à l'exception de la déclaration de mon objet CRReportBO.
et dans mon XAML j'ai mis :
Code:
<TextBox Name="re_title" Text="{Binding ElementName=report, Path=pTitle}" />
Mais ça ne fonctionne pas. Qu'ai-je fait de faux ?