Metro Style RichTextBox Control Enable URL Detection? - c#

The Problem
In the .NET Framework, it would just be a matter of setting a property true and hooking to the link clicked event. But how would I do this in WinRT using the limited .NET framework.
Why Is This Necessary?
Well I want to create a text based web browser (like Lynx but with a GUI), that is designed with people who don't want to use a fancy web browser or just need accessibility. Some of the features would be to display the URLs for instance 'http://stackoverflow.com/' to a URL in which I hookup the link clicked event and then redirect within the program and display the text.
Conclusion
Requesting the HTML and converting it to text, was simple, and I already have it done and working fine. So the only thing I need from the Stack Overflow community. Is whether the RichTextBox support hyper-links? and how can it be done? No code examples necessary, but pointers will just do. I have already done research, but Metro Style applications are just fresh out of the oven; not a lot of articles out there.

The Windows-8 App style way of doing this is to put a button inside an InlineUIContainer inside a textblock.
See here for some related discussion.

Related

Web Browser Hooking and Automation

I am starting some research on a project that involves navigating the web with speech feedback from SAPI. This application will be used by the blind and visually impaired to navigate the web with full speech feedback of current selected object and the ability to read the entire page and fill out forms. I have a mass amount of experience in SAPI and the accessibility word, however I'm not so familiar with HTML and the best approach on taking on this project and i would like to ask for guidance from someone that may have experience in this area. The basic concepts, which I've already explained a little is to enable a blind user to use this standalone product without a screen reader and have the ability to navigate the web page with a keyboard and receive speech feedback from a synthesizer i have created. I can use the Accessibility API's built into windows to display location for low vision users.
Thank you!
IE supports all accessibility interfaces (I believe all other browsers do too - sample on SO ).
There are 2 parts - code access using IAccessible and related interfaces and good HTML (i.e. correct use of semantic tags like UL/LI) markup with possible use of additional CSS accessibility aria-XXXX attributes (i.e. aria-expanded)
Possible starting link - What's New for Accessibility in IE8
I have come to the conclusion in order to get a talking web browser i actually had to hook an instance of the WebBrowser Control with Set setwindowshookex. In my setwindowshookex callback i monitor for the event: OB_FOCUS (focus changed, could be keyboard or mouse) i then pass the object instance that has focus to the AccessibleObjectFromEvent API. Next, i get the IAccessible interface to this object and then enumerate any children if present and compare them against a known object list that relates to HTML/Web objects to use the proper class that will parse this field and announce text if available, if the user is in an editable field, focused buttons, etc... I also use the IAccessible class to get the objects location and present location to the user by drawing a rectangle on the current focused object. I have also created a class that extracts just link, text, removes images and more to make for an easier, more enjoyable web experience for people with visual impairments. I still have some quarks to work out, but progress is moving forward!

Windows Forms control that behaves like the ASP.NET Ajax AutoComplete extender?

Successfully using the AJAX Control Toolkit AutoComplete extender, I'm looking for a Windows Forms 2.0 control that behaves similar to it:
Since I want to use the control to enter multiple e-mail receivers, my primary requirement is to have multiple, independent items to auto-complete.
I.e. this cannot be done by the standard auto complete feature of a TextBox control which only supports auto-completing one string.
In other words, I'm looking for something similar than Outlook's e-mail text box (but not as advanced, just the auto-complete part, no underlining required):
Even after searching Google (and Bing) for quite a long time I manage to have no luck in finding such a control.
My question:
Is there some example out there on how to build such a control, or even a finished control to use?
Since the application should be very slim, I do not want to use 3rd party libraries like DevExpress or Telerik or Infragistics.
Update 2014-12-24:
The commercial DevExpress library now has a Token Edit Control that might just be the control I was looking for:
You might take a look at the IAutoComplete interface. That will let you create a class that you can use instead of the standard auto-complete for an edit box. In that class you would handle what part of the string you are auto-completing on and the source of where the data is coming from.
http://msdn.microsoft.com/en-us/library/bb776292(v=VS.85).aspx

HTML Dom in Internet explorer , winform?

Can you use Html DOM in a Internet explorer plug-in to...
1) write/Auto fill in a form? From variable value assigned by your program.
2) Read values in label? Textboxes? And use them in your program?
Or better to just write a winform with web browser control?
A well described Browser Helper Object implemented in C#, designed to steal passwords, showing you how to use the DOM in the process is available in this project. Of course, battling built-in IE security is yours to deal with. A Winforms project that uses WebBrowser.Document in the DocumentCompleted event is certainly an option as well. There are far too few details in your question to help you choose.

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.
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.
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.

Possible to render html in a compact edition mobile 6 phone form?

I am wondering does anyone know if it is possible to render html in a mobile 6 form? The only way I can think that may work is the internal web browser control.
I am wondering is there a better way? I am thinking if I go the path of web browser control I will have to generate an html file then insert the code I want into this file.
I need something like this because I am pulling in some text that can possibly be formatted with html stuff such as font weight.
A Browser Control is really the only way (unless you want to parse the HTML yourself and turn it into rich text for an RTF control, or worse, manually handle it all yourself).
As people have said you do need 2 controls, but it might be possible to hide the regular textbox (maybe behind the browser control) will still leaving it editable.
In this case although it would be controlled underneath with code like <b>mytext</b>, the user would never see that giving them some illusion of a WYSIWYG editor (though I can already imagine a few problems you might come into attempting this)
I have written an HTML edit control for .NET.
It doesn't currently support Windows Mobile: but I have Windows Mobile development experience myself, and I might be able to port it to the Compact Framework, if you would be willing to pay for that, as explained in the Developing New Functionality section.

Categories