Wpf UserControl hosted in Winforms MDI application. Launch Dialogbox - wpf

I have written wpf Usercontrol which will be hosted in Winforms MDI window. UseControl has a code to launch Wpf Modal dialog box but the positions of the Dialog box is random. I am not sure how to hook the owner property for dialog so that i can center the dialog window to the parent MDI child window.
Ex.
Window w = new Window() //wpf Window
w.Owner = //Don't know how to put Winforms Window here
w.ShowDiaog();
Any ideas please
Thanks

Related

Is it possible to make WPF app mainwindow inaccessible from taskbar while showing taskbar icon?

I have a WPF app which has mainwindow that hosts win32 content. When mainwindow is created I set
ShowInTaskbar = false
and locate it outside screen(s). When it's ready I set
ShowInTaskbar = true
This however causes taskbar icon to be changed to Citrix default icon when run in XenApp Citrix.
So my question is: Can I show the taskbar icon all the time for the app in a way that user can not see/access the mainwindow via taskbar icon?

Popup topmost only outlook window

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.

How to handle the MouseRightButtonDown Event for a Window in Silverlight OOB

I want to disable Silverlight contex menu for a Window in Silverlight OOB application
Window wn = new Window();
wn.Show();
For ChildWindow in silverlight I was able to disable the silverlight default context menu which displays "Silverlight" and "Remove this Application" by handling its MouseRightButtonDownEvent
ChilWindow.MouseRightButtonDownEvent +=(s,e)=>{e.handled=true;};
But I am not able to handle the default contex menu here because the Window class is missing the MouseRightButtonDownEvent
If I put a usercontrol inside the window i am able to handle it for the content inside the window however the contex menu is not disabled in the windows title bar.

How to Open modal window/dialog in XBAP Application?

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

MDI app Menu Shortcut keys getting swallowed when form with WPF ElementHost is active

I have a Winforms MDI app, and my newest form is developed as a WPF UserControl hosted by a System.Windows.Forms.Integration.ElementHost.
I have found that when the MDI child with the WPF content is active, it appears to be swallowing the keyboard shortcuts defined in the main menu of the application (CTRL-F, CTRL-P, F3, for example). Is there a way to tell the WPF usercontrol to pass these keyboard events back up to the Winforms app so the menus get their keyboard shortcuts again?

Resources