I added a Modal Dialog to an existing WPF application. The reason for this was to insert a WinForms WebBrowser control in a WPF application and place the window over my MainWindow such that it appears as a control on the main window form.
I am resizing the modal form and the control when it comes up. Resizing of the modal dialog is disabled and because it is Modal, manipulating the main window once the dialog is up is not an option.
The end result is the top and bottom of the main window appearing behind the modal dialog giving the illusion that this is a control on the main window form.
NOTE: I cannot use a WPF WebBrowser control because it lacks the functionality (Work Offline) of the WinForms alternative. Enable Transparency is also not an option as it makes the Web Browser control transparent as well.
Right now (in my opinion) it looks great but .... I have been tasked with making the ribbon control portion of the main window visible (as if the control is positioned below it) even though it would not be accessible due to the modal view (which is desired.)
If I offset the window by 145 pixels, I'll be there however to expose the ribbon, I have had to diminish the height by 290 pixels because the window is centered over the main window. That leaves the ribbon control visible but it also leave 145 pixels of unused real estate below the control.
The Ideal situation would be if I could declare a top margin (in relationship to the main window) of 145 and shrink the height by 145.
Any Ideas as to how I might address this? I've tried messing with the startup location but no joy.
I'm using the following code to determine the dimensions:
double heightAdjustment = 15; //290 gives ribbon view // 60 gives view of menu
// this.WindowStartupLocation = WindowStartupLocation.CenterOwner; // changed this with no result
UIElement rootElement = (UIElement)System.Windows.Application.Current.MainWindow.Content;
this.Width = rootElement.RenderSize.Width;
this.Height = rootElement.RenderSize.Height - heightAdjustment;
Tom Mann MCSD C#