This is a migrated thread and some comments may be shown as answers.

Eliminate Border

8 Answers 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 03 Oct 2008, 12:43 AM
How do I completely eliminate the border for a RadTextBox?  This is, a RadTextBox that looks like a label.

Thank you.

8 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 03 Oct 2008, 03:05 PM
Hello Tony,

Thank you for the question.

You could hide the border of RadTextBox control by setting BorderPrimitive's visibility property to Collapsed:
(this.radTextBox1.TextBoxElement.Children[2] as BorderPrimitive).Visibility = ElementVisibility.Collapsed; 

Do not hesitate to contact me again if you have other questions.
 

Kind regards,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tony
Top achievements
Rank 1
answered on 09 Oct 2008, 12:09 AM
I have tried to implement what you gave me.  The system does not recognize BorderPrimitive.  This may be because I am using VB .Net.

Could you give me the syntax for this action for VB .Net and tell me if I need to include another namespace.  I am using 

Imports

 

Telerik.WinControls.UI

 

Imports

 

Telerik.WinControls

Thank You

 

0
Martin Vasilev
Telerik team
answered on 10 Oct 2008, 11:58 AM
Hi Tony,

Thank you for getting back to me.

The BorderPrimitive is located in Telerik.WinControls.Primitives namespace. Please, review the code below in VB.Net:
 
Imports Telerik.WinControls.Primitives 
'.... 
 
(TryCast(Me.radTextBox3.TextBoxElement.Children(2), BorderPrimitive)).Visibility = ElementVisibility.Collapsed 

To convert C# code to VB.Net you could use code converter tool provided from Telerik:
http://codechanger.com/

Hope this is useful to you. Contact me again if you need additional assistance.
 

Regards,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tony
Top achievements
Rank 1
answered on 11 Oct 2008, 01:07 AM
That worked great!  I tried to use that echnique to make the border of the ComboBox to disappear.  It seems to be setting the TextBoxItem border invisible in the code, but the border remains.  Could the be another setting to accomplish this with a ComboBox?

Thanks
0
Martin Vasilev
Telerik team
answered on 13 Oct 2008, 04:11 PM
Hello Tony,

Thank you for the question.

You could use the similar approach for RadComboBox. Please review the code-block below as example:
TryCast(Me.radComboBox1.ComboBoxElement.Children(1), BorderPrimitive).Visibility = Telerik.WinControls.ElementVisibility.Collapsed 
 


All the best,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tony
Top achievements
Rank 1
answered on 13 Oct 2008, 04:58 PM
It's good to know I was doing it right, but that still didn't get rid of the border.

Here is what I am doing to make the Combobox look like a label:

 

arrowButton = CType(theControl.ComboBoxElement.Children(2).Children(1), RadArrowButtonElement)

 

 

arrowButton.Visibility = ElementVisibility.Collapsed

 

 

textPortion = CType(theControl.ComboBoxElement.TextBoxElement.Children(2), BorderPrimitive)

 

 

textPortion.Visibility = ElementVisibility.Collapsed

 

 

TryCast(theControl.ComboBoxElement.Children(1), BorderPrimitive).Visibility = ElementVisibility.Collapsed

I am getting something that looks very much like a border around the text portion.

Thanks

 

0
Accepted
Martin Vasilev
Telerik team
answered on 15 Oct 2008, 02:20 PM
Hi Tony,

Thank you for writing.

To achieve label look for the RadComboBox you have to set appropriate BackColors for each visual element. Please, review the code-block below as an example:
 
TryCast(combo.ComboBoxElement.Children(2).Children(1), RadArrowButtonElement).Visibility = Telerik.WinControls.ElementVisibility.Collapsed 
TryCast(combo.ComboBoxElement.Children(1), BorderPrimitive).Visibility = Telerik.WinControls.ElementVisibility.Collapsed 
TryCast(combo.ComboBoxElement.Children(0), FillPrimitive).BackColor = Color.Transparent 
TryCast(combo.ComboBoxElement.Children(0), FillPrimitive).GradientStyle = Telerik.WinControls.GradientStyles.Solid 
TryCast(combo.ComboBoxElement.Children(0), FillPrimitive).NumberOfColors = 1 
 
TryCast(combo.ComboBoxElement.Children(2).Children(0).Children(0), RadTextBoxItem).BackColor = SystemColors.Control 
 

Also, you could find an example project as attachment to this message - I hope it will be useful for you. If you have other questions, do not hesitate to contact me again.

Kind regards,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tony
Top achievements
Rank 1
answered on 15 Oct 2008, 06:14 PM
Thanks, that worked.  I appreciate you sticking with me.
Tags
General Discussions
Asked by
Tony
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Tony
Top achievements
Rank 1
Share this question
or