Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

(WPF)Navigating with windows and custom controls?

I have a problem changing the Content property from a custom control in response to an event.

I have window1 as main and two custom controls. Content is set to first custom control wich has a button.

1.I wish when i push that button to set window1's Content property to the second control.

2.I wish when pressing "Escape" key for example while second custom control is in window1's Content to return the first custom control to window's Content property.
[496 byte] By [w0lfshad3] at [2007-11-11 11:58:05]
# 1 Re: (WPF)Navigating with windows and custom controls?
i think you need to do something like control1.addattribute("doClick",button,"event");
royroy at 2007-11-11 20:42:34 >
# 2 Re: (WPF)Navigating with windows and custom controls?
I don't know how i would use that. I don't know to get a handle of my window1 to the custom controls basicly to manipulate it's Content property.

EDIT-solved: to get a handle:

IntPtr windowHandle = new WindowInteropHelper(
Application.Current.MainWindow).Handle;

or

IntPtr mainWindowPtr = new WindowInteropHelper(this).Handle;

or

make use of the routed events

or

Application.Current.MainWindow.Content
w0lfshad3 at 2007-11-11 20:43:35 >