Calling a method in one code behind from another code behind in WPF -


What is the best way to call a method in the code behind a window, which is the code behind the second window? For example, I have a method in the code behind ShowSamples () my MainWindow , I have a separate window Window2 , once user Clicks on a window on window 2 to show me the ShowSamples () method in the code behind MainWindow . How do I get it?

Note: There is no reference to each other in the windows, they do not inherit a given class and parents are not the ships, 2 windows in completely separate 1 application.

If you are trying to call a method on your current main window, Call your method using the main window, and an artist. Assume that your main window is called Sample Wando, it should work:

  ((Sample Window) application. Current. Manwindows) .ShowSamples ();    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -