How to integrate a WPF dialog with a WinForms app when a HelpProvider is being used? - wpf

I have an existing WinForms app that I'm augmenting with WPF dialogs, using WindowsInteropHelper to handle the parent/child relationship. I've also wired up the ApplicationCommands.Help command to a handler that does this:
System.Windows.Forms.Help.ShowHelp(null, someUrl, someNavigatorContext);
The parent Form also has a HelpProvider which handles F1 for the rest of the application.
My problem is that hitting F1 when the WPF dialog is open shows the help system opening twice! It appears that after the static ShowHelp call, the HelpProvider for the main Form is getting the event and showing help again.

Related

Prevent user interaction with modal dialog while automating UI?

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.

Winform application mdi child title bar issue when maximize in parent...?

I'm using ribbon control for my winform application in mdi parent form, when I open child form in it in maximize mode, it shows title bar spacing under main form.
I want it to behave same like office applications.
like
this is microsoft office excel screenshot, here when I maximize workbook it's control buttons(max,min,close) in same line at ribbon title.
Same thing I'm not able to achieve in my application.
like
Is there any property I need to set for avoiding this issue.
I'm just calling child form on mdi parent load() for example
like

How to close previous window when it redirects to another window in wpf mvvm using caliburn micro?

I am using caliburn micro in my project with mvvm architecure. I created on user control with a single button. when i click on the button it is redirecting to another user control. But the problem is when i redirect to another window, it is attaching to the previous window.
So, can any one help me to how to close the previous window when it redirects to another window.?
Thanks.
This is an old question, but the way I would go about solving this issue is use IoC/MEF to get a reference to the window manager, do a WindowManager.CreateWindow(NewViewModel) to open a new window, then TryClose() the old window.

Embedding of Webbrowser in WPF Form with Address bar + Buttons

I wouldlike to embed a webbrowser in a WPF application. The browser should look like a normal browser, with address bar, back and forward button and status bar. Is there a way how that could easily written in XAML, with a direct databinding of the address to a textbox, with a direct routing of events from the buttons to the webbrowser object, and the enabling back?
Why not?
Here and here are uploaded some screenshots from our application which has WebModule inside and is able to work like browser.
In our implementation we used Windows Forms WebBrowser control as browser engine and MVVM as communication pattern. Model has navigation commands (forward, back, ...) that raise proper events. View is handling this events and delegate requested actions to inner WebBrowser component. Additionally view is handling WebBrowser's events (NewWindow, DocumentCompleted, Navigating, Navigated) and setting up model's state.
Model and view together contain about 500 lines of code (I don't think it's very much, do you?).
Of course, I should mention, that due to using IE engine this browser could have some problems on complicated web-sites.
P.S. We didn't use System.Windows.Controls.WebBrowser because it does not provide access to NewWindow event.
P.P.S. I've posted this answer from browser in our WPF application. Good luck!

Silverlight App inside WPF WebBrowser?

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.

Resources