WPF UserControl works in WPF app, but with BindingSource in Winforms app w/ElementHost, setters are never called

106 Views Asked by At

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.

  1. Yes, my domain object implements INotifyPropertyChanged.
  2. Yes, I implemented "Text" and "Document" DependencyPropertyies 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.)
  3. I adapted my Winforms-to-WPF binding code from the accepted solution in this question: https://stackoverflow.com/a/12054082/2112855
  4. Breakpoints in the WPF UC's setters are never hit when running the Winforms app.

screen capture

            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);
0

There are 0 best solutions below