8 Answers, 1 is accepted
This is not supported by the regex mask. Consider using another mask. What is the format that you want to parse in this case?
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Thanks, I'm looking to restrict input to alphanumeric, underscore and dash. I used the Key Press event check instead and it works for me.
One other question,
I'd like to include a prefix in a textbox, maybe the masked edit box, that is based on a selection from a drop down. Ie, the user picks a project from the drop down and I want to include the 4 digit project ID in the textbox as a non changeable prefix. I currently fake it by placing a label in front of the text box. Any ideas for that?
You can use the approach from this article: Adding Buttons to RadTextBox. Here is an example that demonstrates it:
LightVisualElement label = new LightVisualElement();label.Margin = new Padding(0, 0, -3, 0);label.Text = "9999";RadTextBoxItem tbItem = this.radMaskedEditBox1.MaskedEditBoxElement.TextBoxItem;this.radMaskedEditBox1.MaskedEditBoxElement.Children.Remove(tbItem);DockLayoutPanel dockPanel = new DockLayoutPanel();dockPanel.Children.Add(label);dockPanel.Children.Add(tbItem);DockLayoutPanel.SetDock(tbItem, Telerik.WinControls.Layouts.Dock.Right);DockLayoutPanel.SetDock(label, Telerik.WinControls.Layouts.Dock.Left);this.radMaskedEditBox1.MaskedEditBoxElement.Children.Add(dockPanel);I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Hi, I'm attempting to use this example in a RadTreeViewNode. Is it possible to use the DockLayoutPanel in a tree view node?
If not. Is there a way to get a similar behavior from a StackLayoutElement? Using the StackLayoutElement, the Textbox overlaps the label, the textbox doesn't size to fit the nulltext value, and as you type the textbox moves to the right. See the attached images.
One last behavior with the textbox in my code and the forum sample https://www.telerik.com/forums/custom-nodes-in-tree-view. When the textbox you're typing in loses focus, the text is also removed.
Yes, it is possible to use DockLayoutPanel just like any other elements. An example is available here: DockLayout.
In addition, I cannot suggest a solution before examining your implementation. Would it be possible to share the code of the custom node element?
I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik
Thanks Ditmar, Focusing on the first questions in this post. I'm creating the DockLayoutPanels dynamically and the sample appears to assume that I've already declared the DockLayoutPanel at design time.
Is it a simple change to address a dynamic build?
Building on my previous sample. DockLayoutPanel is not declared.
Thank you so much for your help!
Imports Telerik.WinControls.UIImports Telerik.WinControlsPublic Class RadForm1 Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles Me.Load Dim rtvTest As Telerik.WinControls.UI.RadTreeView = tvProjectPath tvProjectPath.Nodes.Clear() Dim DFSRootNode As New RadTreeNode("Root0") Dim ProdDataNode As New RadTreeNode("Child1") Dim JobsNode As New RadTreeNode("Child2") Dim ProjectRoot As New RadTreeNode("Child3") 'Dim ProjectFolder As New CustomTreeNodeElement() tvProjectPath.Nodes.Add(DFSRootNode) DFSRootNode.Nodes.Add(ProdDataNode) ProdDataNode.Nodes.Add(JobsNode) JobsNode.Nodes.Add(ProjectRoot) 'ProjectRoot.TreeViewElement = End Sub Private Sub CustomNodes_Load(sender As Object, e As EventArgs) Handles Me.Load Dim test As String = "" Me.tvProjectPath.ExpandAll() End Sub Private Sub TreeViewElement_CreateNodeElement(sender As Object, e As Telerik.WinControls.UI.CreateTreeNodeElementEventArgs) Handles tvProjectPath.CreateNodeElement e.NodeElement = New CustomTreeNodeElement() End SubEnd ClassPublic Class CustomContentElement Inherits TreeNodeContentElement Private nodeContentContainer As StackLayoutElement Private nodeLabel As RadLabelElement Private nodeTextBox As RadTextBoxControlElement Protected Overrides ReadOnly Property ThemeEffectiveType() As Type Get Return GetType(TreeNodeElement) End Get End Property Protected Overrides Sub InitializeFields() MyBase.InitializeFields() Me.StretchHorizontally = True End Sub Protected Overrides Sub CreateChildElements() MyBase.CreateChildElements() nodeContentContainer = New StackLayoutElement nodeContentContainer.Orientation = Orientation.Horizontal nodeContentContainer.StretchHorizontally = True nodeContentContainer.StretchVertically = False nodeLabel = New RadLabelElement Me.Children.Add(nodeLabel) nodeTextBox = New RadTextBoxControlElement Me.Children.Add(nodeTextBox) End SubEnd ClassPublic Class CustomTreeNodeElement Inherits TreeNodeElement Protected Overrides Function CreateContentElement() As TreeNodeContentElement Return New CustomContentElement() 'Dim node As RadTreeNode = Me.Data End Function Protected Overrides ReadOnly Property ThemeEffectiveType() As Type Get Return GetType(TreeNodeElement) End Get End PropertyEnd ClassPublic Class MyDockLayoutPanelElement Inherits RadElement Protected Overrides Sub CreateChildElements() Dim button1 As New RadButtonElement("button1") DockLayoutPanel.SetDock(button1, Telerik.WinControls.Layouts.Dock.Left) Dim button2 As New RadButtonElement("button2") DockLayoutPanel.SetDock(button2, Telerik.WinControls.Layouts.Dock.Right) Dim button3 As New RadButtonElement("button3") DockLayoutPanel.SetDock(button3, Telerik.WinControls.Layouts.Dock.Top) Dim button4 As New RadButtonElement("button4") DockLayoutPanel.SetDock(button4, Telerik.WinControls.Layouts.Dock.Bottom) Dim dockPanel As New DockLayoutPanel() dockPanel.Children.Add(button4) dockPanel.Children.Add(button3) dockPanel.Children.Add(button2) dockPanel.Children.Add(button1) End Sub End ClassPublic Class MyDockLayoutPanelControl Inherits RadControl Protected Overrides Sub CreateChildItems(parent As RadElement) MyBase.CreateChildItems(parent) parent.Children.Add(New MyDockLayoutPanelElement()) End SubEnd ClassThis is a static method and you do not need to declare an instance. You need to add the following namespace:
Imports Telerik.WinControls.LayoutsI hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
