This Winforms app works fine, but I'm now trying to add a bound WPF UserControl to it via ElementHost, and my attempts at binding it have no effect.
Left two thirds of screen capture are normal databound Winforms controls. Right third of screen capture is my WPF UserControl (which houses a ToolBar, RichTextBox, and a (strictly for debugging, will be removed later) plain TextBox.)
Expected Result: When I switch projects in leftmost pane, (WPF) "HelloText" should be replaced with the text seen in the Problem Statement" (Winforms) TextBox.
Actual Result: "HelloText" never changes.
- Yes, my domain object implements
INotifyPropertyChanged
. - Yes, I implemented "Text" and "Document"
DependencyProperty
ies in the root of the WPF UserControl that do modify the inner controls' values (works when written to in my throwaway WPF tester app, but not the Winforms app seen in the screen capture.) - I adapted my Winforms-to-WPF binding code from the accepted solution in this question: https://stackoverflow.com/a/12054082/2112855
- Breakpoints in the WPF UC's setters are never hit when running the Winforms app.
System.Windows.Data.Binding wpfb2 = new System.Windows.Data.Binding("ProblemStatement") // WPF
{
Source = _bs,
UpdateSourceTrigger = System.Windows.Data.UpdateSourceTrigger.PropertyChanged
};
rteProblemStatement.SetBinding(WpfRichTextEditor.RichTextEditor.TextProperty, wpfb2);