Good morning
I wanted to follow the tutorial to make a RadButtonTextBox password control with a button to the right of the textbox to show the password.
I found a tutorial but can't find how to add the image. The tutorial page is this
https://docs.telerik.com/devtools/winforms/knowledge-base/create-password-textbox
, can someone please tell me how to add the image?
Thanks so much
Fabrizio
1 Answer, 1 is accepted
Hello, Fabrizio,
The two images eye32 and eye32hidden are added as a Resource in the project. Then, the button element that shows the eye is added to the right buttons panel that RadButtonTextBox offers. More information how to add buttons to the left/right side of the control is demonstrated in the following help article:
I have prepared a sample project for your reference. Please give it a try and see how it works for your scenario.
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
How can I use this method for a TextBoxControl instead of just the TextBox?
The part it doesn't seem to like is this
radButtonTextBox1.RightButtonItems.AddRange(radButtonElement1);
Hi, Damien,
RadButtonTextBox is a different control compared to RadTextBox and RadTextBoxControl. It offers separate collections for storing the left/right button elements:
https://docs.telerik.com/devtools/winforms/controls/editors/buttontextbox/structure
Could you please share your concerns and why the specific RadButtonTextBox is not appropriate for your scenario and you want to change it with another control? Thus, we would get better understanding of the precise case and think about an appropriate solution. Thank you in advance.
Hi Dess
The issue I have with a "TextBox" component is the selection highlight colour cannot be changed to fit the theme of the application.
If I can use the RadButtonTextBox and change the selection highlight colour, I think I can use it.
Thanks.
Actually, I just tried it, and the button does not work when used on a touchscreen device but works when you attach a mouse. Therefore it is of no use to me unless the touch can also work.
I had to change it to a RadToggleButtonElement for the touch device to work and set it as toggled on or toggled off.
RadButtonTextBox internally uses RadTextBox. Hence, it also hosts the standard MS TextBox which doesn't allow changing the selection color:
Using a RadToggleButtonElement is also a suitable approach. Feel free to use it if it achieves the custom requirement you need to cover.
If you need any further assistance please don't hesitate to contact me.
Can you disable the right-click context menu?
thanks
Hi, Damien,
Yes, you can disable the right-click context menu for RadButtonTextBox by using the following line of code:
this.radButtonTextBox1.TextBoxElement.TextBoxItem.TextBoxControl.ContextMenu = new ContextMenu();
Before:
After: no context menu on right-click:
Did you ever get a solution here? I was looking at Adding Buttons to RadTextBox—WinForms TextBox Control—Telerik UI for WinForms, where I can add the button with an icon. However, doing so increases the size of the text box's height. It's not a huge deal, but I would love to keep the textbox height the height it was originally designed to be.
Hello, NTSAdmin,
In this forum thread a RadButtonTextBox control is discussed. However, you said that are looking into Adding Buttons to RadTextBox—WinForms TextBox which refers to RadTextBox which is another control.
Can you please clarify which is the exact control that you use since RadTextBoxButton and RadTextBox are two different controls in our suite. They may have similar behavior but their inner element's structure is different:
- RadButtonTextBox : Overview - WinForms ButtonTextBox Control - Telerik UI for WinForms
- RadTextBox: Overview - WinForms TextBox Control - Telerik UI for WinForms
What I can suggest is to consider using smaller images, by setting some size of the image so that it can fit into the textbox or set some margin or padding of your text box. If you are still having difficulties, it would be much helpful if you provide a sample project or a code snippet with the exact problem that you are facing. Thus, I could be able to provide further assistance.
I hope this information is useful. Please let me know if I can assist you further.