none
using a WPF custom control in Winforms RRS feed

  • Question

  • I am making a wpf custom control in Winforms. I am using an element host to  embedded the wpf control in to my  Winforms.

    I have a few different ellipses in my wpf custom control and they all have a mouse down event handler, and in run time went i click on a ellipses, I can change their color ,  but my question is how do I seen that information to my winform application from my wpf? 

    I tried this :

     private void elementHost1_ChildChanged(object sender, System.Windows.Forms.Integration.ChildChangedEventArgs e)
            {
                int stop =0;
            }
    
    
      private void Ellipse_MouseDown(object sender, MouseButtonEventArgs e)
            {
                Ellipse EP = sender as Ellipse;
                string tempS = EP.Name;
                EP.Fill = Brushes.Green;
    
                int you = 0;
            }
        }

    The ellipse will change color, but the  elementHost1_ChildChanged event is not being called. 

    Sunday, September 15, 2019 5:12 PM

Answers

  • Hi Btb4198,

    Thank you for posting here.

    >>The ellipse will change color, but the elementHost1_ChildChanged event is not being called.

    I have tested the code according to your description. I think you misunderstand the ChildChanged event.

    It occurs when the Child property is set instead of wpf usercontrol has been changed.

    Hope my explanation could be helpful.

    Best Regards,

    Jack



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Btb4198 Monday, September 16, 2019 4:01 PM
    Monday, September 16, 2019 3:21 AM
    Moderator