In WPF, if i want to open a modal/response window then i write code like
Window1 _windowObj1 = new Window1();
_windowObj1.Owner = mainWindowObject;
_window1Obj.ShowDialog();
How to do the same in XBAP. I tried it, but the window is opened independently from the parent page as i cant assign it as a Owner of modal window.
How to Open modal window/dialog in XBAP Application?
I'm not really experienced with XBAP apps, but I believe you should try displaying "popups" in an adorner layer. This has the same effect (you can't access the rest of the application), but doesn't actually open another window according to windows. Google for "wpf adorner dialog" and you should get some results.
Here are some links:
How do I make modal dialog for a Page in my WPF-application?
http://www.codeproject.com/KB/silverlight/slmodal.aspx
http://www.codeproject.com/KB/WPF/wpfmodaldialog.aspx
You did implement Window of WPF? If so, it will not work in XBAP. Please host your UserControl to Windows.Form, then you can open modal window/dialog in XBAP Application
Related
I am automating a "save as" dialog through win32 API in a WPF project. The dialog is called internally from the IOleCommandTarget interface of InfoPath 2013. So I do not have access to how the save as window is initialized as far as a DoModal() method or anything similar.
The issue is I do not want the user to be able to interact with the save as window at all. Some things I have tried are ShowWindow with SW_HIDE, SetWindowPos to move the window off screen or below the main application window, and SetLayeredWindowAttributes to make the window transparent. None of these approaches has worked to hide the dialog.
I have created a Outlook Addin Project and I used WPF user control as element host in UserControl(WinForm) which is loaded using Custom Task Pane.
I have some dragoperation in wpf usercontrol which will open Popup.
The problem is the popup is showing topmost window for all the windows.
I need to show/visible only when outlook window activated. Appreciate your help
You need to make sure your popup is a child of the appropriate Outlook window. You cast Outlook Inspector or Explorer object to IOleWindow interface and call IOleWindow.GetWindow to retrieve HWND. You can then use WindowInteropHelper class along with the retrieved HWND to display your window.
I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.
I created a Silverlight window and I want it to appear when I press a button. How can
I do that? It doesn't has a "show" method...
To open a new address in a new window use:-
HtmlPage.Window.Navigate(new Uri("the address here"), "_blank");
see:
Silverlight Simplified MVVM Modal Popup
http://www.codeproject.com/KB/silverlight/MVVMPopUp.aspx
If you want to browse to a new silverlight application hosted in another html page you should use the NavigationService class to accomplish that.
If you on the other hand want to display another view defined in your silverlight application then you should do something like this Silverlight 3 Navigation.
I am creating a page with Silverlight component and some HTML controls.
On enabling Silverlight's full screen, I am unable to view the background HTML controls. Even if I set the xaml's background to transparent.
Please let me know if it's possible to view the HTML controls in full screen mode of Silverlight or not.
Thanks
I doubt that such thing is possible, for security reasons, as the keybordsupport in Fullscreen is. It would enable you create such things as a app totally visible observing the movements.
But I might be wrong !
Fullscreen mode takes the content currently restricted to rectangle on hosts window (the Browser client area window) and displays it on full screen window. This full screen window is a new window and contains only the Siverlight content.
When silverlight is rendering in a windowless mode it is simply rendering directly on to the host window. When you got fullscreen mode in Silverlight you are not affecting the hosts window, fullscreen effectively suppends windowless mode as it needs a new window of its own to render on.