How use AddressChanged event in CefSharp WPF? - c#

I try to develop WebBrowser on c#, wpf and CefSharp for experience.
Use tabcontrol for tabs and TextBox for URL textbox.
I want, when address of page is changed, textboxurl was updated too.
So in CefSharp for WinForms i find AddressChanged event.
Like in this video https://www.youtube.com/watch?v=itpEj1yB_Tg
But when i want use it with CefSharp WPF i cant use it.
So maybe i can add it by myself?
I find ChromiumWebBrowser.OnAddressChanged Method in APIDoc.
http://cefsharp.github.io/api/51.0.0/html/M_CefSharp_Wpf_ChromiumWebBrowser_OnAddressChanged.htm
How can i use it?

Related

making WPF webbrowser not accessible for user

maybe it's quite easy question, but I haven't managed to find a solution. I'm using web browser only to display data, and don't want user to access shown webpage. I know that in win forms' webbrowser it's possible, but how can I achieve it using WPF control?
PS I don't want to lock browser action in the navigate event, as described here: How can I make a WPF WebBrowser read-only? , because this won't stop my user from running javascripts etc
PPS And I also don't want to disable js, because I want it to be used by webpages. What is more, I'm executing it from code, as long as navigating between sites
Add this to Windows_Loaded Event
webbrowser1.IsEnabled = false;

How can I set focus to explorer in C# WindowsApiCodepack, when used in WPF via WindowsFormsHost

i´m writing a small C# Wpf application and I integrated the ExplorerBrowser of the WindowsApiCodepack.
This is working really nice.
The only problem I have and where I haven´t found a solution so far is:
How can I programatically set the focus (keyboard focus) to the ExplorerBrowser control, so that I can select a folder without clicking on it with the mouse before?
Does someone have exerience with the control?
Additional Note:
What I found out so far is, that focus problems are a common problem for winform controls, which are inserted into a wpf window via the WindowsFormsHost class.
But i haven´t found a good workaround so far.
I don't have a clue about the WindowsApiCodepack, but I think u just have to call the ".Focus()" function of the control.

How to capture the WebBrowser control close event?

I have a WebBrowser control in a WPF application. The browser control is in a grid and when the WebBrowser control renders some webpages, in one of the pages there is popup alert box from the webpage, and when the user taps on the popup the WebBrowser control seems to be closed. I need to capture this close event and take some action.
I already tried subscribing to the unload event but it does not seem to fire. Is there any way to get this event captured?
There is WindowClosing event on the underlying WebBrowser ActiveX control for that. I haven't tried it myself, but I think it should work.
Here's a full-fledged sample showing how handle the "underlying" WebBrowser events like that. It's for WPF, but it can be easily adapter for WinForms (using WebBrowser.ActiveXInstance).

C# WP8 Open TimePicker from code

How can I open the TimePicker to select new time but from C#? Not by tapping the control.
Is there any simple way to do that?
I had the same problem once. I solved it by forking the Windows Phone Toolkit and making the OpenPickerPage of the control public.
(I assume you mean the Windows Phone Toolkit TimePicker control here.)
From reading the source code of the DateTimePickerBase, it would seem not. Opening the picker page is done by the OpenPickerPage() method, which is private, and is only called from the OnDateButtonClick method, which is also private and handles the Click event on a private Button.
Of course, as the control is open-source, you can take the source code of the control and make your own copy of it with one of these methods exposed. As far as I can tell, it's allowed under the Ms-PL.

Creating a round button

In my wp7 app, I use C# to create user interface. I want to create a round button in C# not in xaml. is it possible to do that only in C# (not with the help of xaml) ? if yes, how to do this? and also please explain how to change a style of a button or any other control by using C# code?
Yes you can but don't know why you'd want to. Much easier to do with styles. Even easier to use one from an existing toolkit.
There is a round button in the Coding4Fun Phone Toolkit.
Get it via NuGet or download it here

Categories