WPF: Calling a method from a different "branch" of the tree
Posted
by sofri
on Stack Overflow
See other posts from Stack Overflow
or by sofri
Published on 2010-05-12T10:09:56Z
Indexed on
2010/05/12
10:14 UTC
Read the original article
Hit count: 240
Hey, I'm doing a WPF Application.
The tree looks like this:
SurfaceWindow --- Startscreen
..........................-------- Page---------- Subpage
I'm trying to call a method from the "Subpage" from the "Code Behind" of the Startscreen(Startscreen.xaml.cs).
The method from the Subpage looks like this:
public void showTheme(ThemeViewModel theme) { ... }
If know that I can call it when I'm on the "Page" or the "SurfaceWindow", because it's in the same "branch" of the tree, and I just do something like this:
ThemeViewModel theme = (ThemeViewModel)mvm.CurrentItem.ThemeViewModel;
katalog.katalogblatt.showTheme(theme);
But how do I do it when I'm not on the same branch of the tree and want to call the method?
© Stack Overflow or respective owner