wpf dialog always on top

Add-in Express™ Support Service
That's what is more important than anything else

wpf dialog always on top
how to get the child of the inspector 
wehbi




Posts: 57
Joined: 2013-10-31
Dear ADX-Team,

I'm trying to use a WPF Window instead of a Forms dialog.

To set the owner I'm using the following code:


OLWindowHandle = cs4outlook.AddinModule.CurrentInstance.GetOutlookWindowHandle(inspector);

WindowTransferDialog winTransDia = new WindowTransferDialog();
new System.Windows.Interop.WindowInteropHelper(winTransDia).Owner = OLWindowHandle;
winTransDia.Show();


As far as good.
The WPF dialog stays always in front of the inspector.

Now I want to disable the mail inspector while the WPF dialog is shown. For this I want to switch the focus from the inspector to the WPF dialog by using the InspectorActivate event.

How can I access the child from the owner window and is this a proper way?

Thanks in advance and regards,
wehbi
Posted 13 Jan, 2014 02:46:25 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hello,

wehbi writes:
To set the owner I'm using the following code:


In what event do you do this?

wehbi writes:
For this I want to switch the focus from the inspector to the WPF dialog by using the InspectorActivate event.


This is impossible.

Can you please provide more details about your goals? Can it be that you need to show your form instead of the mail inspector?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 13 Jan, 2014 04:17:44 Top
wehbi




Posts: 57
Joined: 2013-10-31
Hello Andrei,

thanks for your reply and sorry for my bad explanation.
The thing I want to achieve is to use a WPF window in the same manner as a windows forms dialog.
When open a forms dialog out of an inspector, the forms dialog is always in front of the inspector and the inspector is not reachable for the user until the forms dialog has been closed. The focus is always set to the forms dialog.

I open the WPF window by catching the ItemSend event.

Thank you very much and kind regards from Germany,
wehbi
Posted 13 Jan, 2014 06:45:53 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Thank you for the explanation.

The description is okay: you can use a WPF form as a dialog window. I suppose I don't understand your "switch the focus from the inspector to the WPF dialog" in the original post: it is impossible to switch the focus from a dialog window.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 13 Jan, 2014 06:53:42 Top
wehbi




Posts: 57
Joined: 2013-10-31
If I show the window as described in my snippet, the inspector which is the owner of the dialog is active and not locked (not focusable) as usual when using a dialog window.

The problem is that I'm using Show() instead of ShowDialog() I think. But the ShowDialog() call is not working, the window will not be shown.
Furthermore I want the dialog only lock the inspector which he is responsible for and not the whole Outlook application.

The reason is that I want the user to configure attachments, recipients eg. in the WPF window before he is sending the mail.

Everything would be fine when the inspector were inactive after opening the responsible WPF window. I thought it could be a workaround to switch the focus to the dialog window while it is open.

Thanks and regards,
wehbi
Posted 13 Jan, 2014 08:15:05 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Thank you for describing this. I suppose your requirements can be implemented using a pane instead of the window. Also not that from our experience such a window should be shown modally as non-modals interfere with the windowing of the host application.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 13 Jan, 2014 08:37:46 Top
wehbi




Posts: 57
Joined: 2013-10-31
Dear Andrei,

thanks for your help! I solved my problem by holding a reference of the inspector within my WPF window. When the InspectorActivate is fired I check which WPF window containing the ref and set it active.

Regards!
Posted 14 Jan, 2014 02:15:13 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Great!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 14 Jan, 2014 03:36:23 Top