how to change the layout of a control inside a parent wpf form from a child winform? -
i have 2 separate projects inside solution, 1 wpf other windows form , have referenced winform wpf project.. inside wpf window image control, when clicked, windows form button appear.
how can able change image source of image control inside wpf form when button inside winform clicked...
i have seen similar question cant understand answers...
you pass delegate/action winform perform action
here quick example
wpf
public partial class mainwindow : window { public mainwindow() { initializecomponent(); } private void button_click_1(object sender, routedeventargs e) { // pass in method want call when winform button clicked var winform = new form1(() => changeimage()).showdialog(); } private void changeimage() { // change image logic } } winforms
public partial class form1 : form { private action _action; public form1() { initializecomponent(); } public form1(action action) { _action = action; initializecomponent(); } private void button1_click(object sender, eventargs e) { if (_action != null) { // call method in wpf form _action.invoke(); } } }
Comments
Post a Comment