What is the usage of AccessibleRole property in a user control? - c#

there are two properties with these names in user control :
1- AccessibleName
2- AccessibleRole
What are these properties and what's their usages in an win form application?
I have already take a look at MSDN but unfortunately I couldn't understand their descriptions?
any help will be appreciated

Those are special attributes that can be used by screen readers or text-to-speech programs to make your program accessible to people with disabilities or who use assistive technology.
AccessibleName can be used to tell the user the element the cursor is sitting in. E.g. the assistive technology program can't determin which label around the text box belongs to it, but it's able to read that attribute (i.e. "what's the meaning of this box?"). A more detailed description can be added to AccessibleDescription.
In a similar way AccessibleRole describes the user (or tells the tool) what kind of control this is. This isn't as important for the standard controls, but imagine some custom button or hyperlink control: With this attribute it's able to tell "Hey, I'm clickable and I'm a button/link!".

Related

MS Office Word: How to create a custom minibar to a content control (richtext) in C#?

I am trying to modify a custom content control I've created. Specifically I want to add a minibar containing one or two buttons to a quick and short modification of the text included in my content control. The image below shows the outcome I want to have - the problem is that these buttons are only shown in built-in table content control and I can't find any useful information on the web about how to create something like that myself... Could you help me?
Unfortunately, the commands shown next to the content control title are not customizable; it's definitely something we've thought about, but this isn't possible today.
You could use the ContentControlOnEnter and ContentControlOnExit events to show buttons on the context menu or the ribbon; depending on your scenario, that might work?

Modifying form fields with FieldEditingControls

I’m trying to add a honey pot field to our contact us form. When I add hidden field to the form via the Kentico GUI (with conditions making it invisible) it’s not available in the source so I don’t think it will actually work. However I also tried adding the form via the GUI and trying modify the style on prerender in my form control won’t work either (Code below). It is odd as it will actually let me change the value of the field in my form control but not the styling. Is this typical of Kentico and is there a solution to trying to implement a honeypot field? I had suggested we just add more validation methods to the form, but I was told that they want the same behavior as the existing forms.
Here is the method I’m using.
((CMS.FormControls.EditingFormControl)viewBiz.BasicForm.FieldEditingControls["Pooh"]).Style.Add("display", "none");
Thanks
Under the advanced properties of the field input, you should be able to apply styles to the input. You could set display:none; there to hide it from the user, but still have it available in the source.
I'm also going to create a form control for this so that it can easily be applied to another with some validation functionality (i.e. a redirect to captcha)

Textbox control like "TO" field in outlook

I'm looking for a Textbox control that works similar to the email recipient textboxes in Outlook (the To, Cc and Bcc inputs). It shall have below characteristics.
Allow user text inputs with auto complete based on history
Word/Phrase identification, separation, underlining (like links)
Keep a list of objects represented by these words/phrases
Once click on a work/phrase fire an event to show the corresponding object related to that entry.
If nothing is out there, I may look to develop one by my own. Any help to direct me either on existing controls or how to do it, is highly appreciated.
Tks,
- Eranga
I don't know of products out there but i'd approach this problem by having a look at the code in the richtextbox WPF Extended toolkit (you can nuget it but i'd download the code)
In there is a formatter which will allow you to markup flowdocuments in the rtb. if each address is stored as a run in the rtb you have your list of separate items which you can process as you like. there also a bunch of events you can hook into as well.
All this assumes you are using WPF.

Handling text with embedded links in a windows form

I am trying to break out of vb into c# and needed a personal project to get some c# practice in to cement the syntax differences in my mind.
I decided (for want of something better) to write a little twitter client, only something basic.
I have designed a user control to contain the info about each tweet (the tweet itself, the user that tweeted, the date and time etc). As we know tweets can contain embedded links in their text and I was wondering how you handle this in a windows form.
There seems to be a Linklabel control, but you don't seem to be able to have normal text in it, the Label control similarly doesn't support clickable links.
Would I have to embed a link label inside a normal label control and parse the tweet text for url's?
Or am I approaching this in completely the wrong way? :)
You can (sort of) combine normal and linked text in a LinkLabel:
this.linkLabel1.Text = "Here is some text";
this.linkLabel1.LinkArea = new LinkArea(0, 4);
Problem is, there can only (AFAIK) be one link destination, which is obviously not going to work for your purposes.
One possibility may be to use the RichTextBox, and handle the LinkClicked event. I'm not sure if that will give you enough information, but if nothing else, will provide some good practice, since that's the goal anyhow!

DateTimePicker-like Input Control

I'm not very experienced with .NET development, so forgive me if I've missed something obvious.
My scenario is quite simple: my program is going to deal with both the Imperial and Metric systems of measurement. I need an input control that will be able to elegantly house {feet, inches} and {meters, centimeters} (only one set at a time).
From what I've seen in VC#'s Control Toolbox (Winforms .NETF 3.5), I'm looking for a mix of MaskedTextBox, NumericUpDown, and DateTimePicker.
Namely:
MaskedTextBox's ability of filtering user input
NumericUpDown's ability of [in/de]crementing the user-selected [sub-]unit of measurement
DateTimePicker's ability of "breaking apart" information in a single control. I'm specifically interested in breaking apart say feet and inches while still displaying them on the same control
I should also point out that I'm most interested in replicating DateTimePicker's ability to keep separate pieces of input in a single control.
I would greatly appreciate your thoughts as to what base control I should sub-class in order to achieve this functionality.
Cheers!
Have you looked at this code project article which might be a starting point.
I think DateTimePicker isnt enough flexible to make that.
You should create a composite user control. The main control should contain:
Three NumericUpDown control (year, month, day)
Delegate events to every Validate event (instead of masked textbox)
Show a Calendar control when ie. user click into the NumbericUpDown control (or you can dedicate an '...' labelled button on the right)
Or yoou can search on CodeProject or Codeplex for opensource, and Telerik and DevX for shareware components.

Categories

Resources