I am trying to create a usercontrol in WPF to show in a windows forms application using visual studio. I've followed a tutorial or two but think I am getting the concepts wrong.
I am trying to use WPF as a control designer and handle it's functionality from my Windows forms application.
I have created a WPF user control, consisting of a shaded rectangle with a text block over it, and a couple of buttons.
I've then added the control to my form by dragging it from the toolbox to the canvas.
How do I then detect and handle the button-presses on the control, or write text to the textblock on the control? I can't seem to reference them from the windows forms application.
-- Steps to reproduce what I have so far.....
- Create new vb.net forms project.
- From Solution Explorer, add new item -> WPF User Control
- Draw 2 buttons (named myButton1 and myButton2)
- Draw TextBlock (named myTextBlock)
- Compile Project
- Drag UserControl1 from WPFTestApp WPF User Controls onto form 1
That now displays correctly, but how do I add events to the buttons, or write data back to the text block?