My WPF project has a main window with a number of buttons and a frame. I display a page within the frame, and the buttons above use routed commands in order to call methods present in the page below. With me so far?
Everything works fine until I change the page. Even though this new page has methods which relate to the commands, it seems the routed commands are still looking for methods in the previous page. I don't know why this is happening when I've set the typeof() argument in the command itself:
public static RoutedCommand cmd = new RoutedCommand("Foo", typeof(BarPage));
How can I fix this? I've noticed that setting focus on a textbox in the newly-selected page will correct things, however this isn't a viable solution as the page will not always contain fields. I've also tried setting focus on the page itself but the problem still applies.
Thanks in advance.