This question is locked. New answers and comments are not allowed.
Is it possible that RadModalWindow.WindowOpended event is fired to early?
Basically what I'm trying to do is navigate to an URL every time the window is opened. So I used WindowOpended event to do that. But I'm getting an exception: "You cannot call WebBrowser methods until it is in the visual tree."
Take a look at the following code:
Currently I have a workaround using a Timer that will fire after 250 ms and then call browser.Navigate(). That works fine. But it would be great if this will work without a timer.
Basically what I'm trying to do is navigate to an URL every time the window is opened. So I used WindowOpended event to do that. But I'm getting an exception: "You cannot call WebBrowser methods until it is in the visual tree."
Take a look at the following code:
RadModalWindow window;WebBrowser browser;private void button_Click(object sender, RoutedEventArgs e){ if (window == null) { window = new RadModalWindow(); browser = new WebBrowser(); window.Content = browser; window.WindowOpened += new EventHandler<EventArgs>(window_WindowOpened); } window.IsOpen = true;}void window_WindowOpened(object sender, EventArgs e){ // always navigate to the same url when opening the window browser.Navigate(new Uri("http://www.google.com"));}Currently I have a workaround using a Timer that will fire after 250 ms and then call browser.Navigate(). That works fine. But it would be great if this will work without a timer.