Moonlight
Moonlight

Reputation: 545

Can I use the WPF WebBrowser control as a UI interface in C#?

Is it possible to use the WebBrowser control as a UI interface in C#?

I like to write a string of HTML directly into the control and get an event and read the value of the hyperlinks when such a link is clicked. HTML is a great rendering language and it seems to be a waste if we could not use this technology in applications.

If this is not possible are there any good alternatives, as the WPF controls are not 'fluid' enough. I require a very flexible rendering environment but prefer not to reinvent the wheel.

I like to clarify that of course I can include such a control and get and send data using HPPT or other protocols but in my case I want to directly assign a string of HTML and capture the click on hyperlink events.

Upvotes: 1

Views: 1379

Answers (2)

Yvo
Yvo

Reputation: 19263

You could use the WebBrowser control to render your application's UI. I would advise against it. Versions of the controls could influence the way your application renders and it's going to be a hasle to mantain all the resources used in the UI (html, pics, javascript?)

Read a bit more on WPF, Expression Blend 3 was just released and you can make an awesome UI with it. To keep it fluid don't go crazy on things like transparency, it slows down loading times. WPF is a far more future proof technique.

Upvotes: 1

Tamás Szelei
Tamás Szelei

Reputation: 23921

You can host any Windows Forms control in a WindowsFormHost (you'll probably find it in the toolbox.

However, FlowDocument maybe more suitable for such things, as it's truly WPF, so it can be the content of any control.

Upvotes: 1

Related Questions