Telerik Forums
UI for WinForms Forum
1 answer
11 views

I have a situation where I have code that executes when the Selected Node  is changed.

SelectedNodeChanged

 

The code in the SelectedNodeChange adds controls to some FlowLayoutPanel.

When a user clicks on a node, you can see the controls being added to the control

but the RadTreeView allows the user to select another node eventhough the SelectedNodeChange event has not finished, which

is now causing issues with the FlowLayoutPanelshowing duplicate controls.

 

If user waits until all controls are in the FlowLayoutPanel, and then selects another node, everything works as expected.

 

None of the code that adds the controls to the FlowLayoutPanel are Asynchronous.

 

I DO NOT have Multiselect = true.

 

** I have noticed that the RadTreeView acts as though it is Asynchronous when filling it.  I have code that fills the nodes and you can select the nodes and see the nodes being added behind the scenes. 

Maybe control is Asynchronous when changing selected nodes?

 

 

Nadya | Tech Support Engineer
Telerik team
 answered on 18 Nov 2025
0 answers
26 views
I implemented custom nodes by referring to https://docs.telerik.com/devtools/winforms/controls/treeview/working-with-nodes/custom-nodes.
I want to display an icon on the left, and on the right, display Title, line, and Text in order from top to bottom.
The first problem is that when displaying, the distance between line and Text is large, and adjusting the Padding and Margin of each element in CreateChildElements has no effect. See Figure 1 and Figure 1-1. If other items are commented out and only Title or Text is retained on the right, the display is correct, and it also displays correctly when TextWrap = true, as shown in Figure 2 and Figure 2-1.
The second problem is that when both Title and Text are displayed correctly, the display area is wrong when TextWrap = true, as shown in Figure 3,Figure 3-1.
The red rectangle in the figure indicates the error point.
Does anyone know where the problem lies?
yw
Top achievements
Rank 2
Iron
Iron
 asked on 30 Aug 2025
2 answers
30 views

WinForms TreeView displays icons and text. How to obtain the Rectangle of the icon area, or how to implement the click event of the icon. Through the method in https://www.telerik.com/forums/hovering-over-node-image: 
TreeNodeImageElement imageElement = radTreeView1.ElementTree.GetElementAtPoint(e.Location) as TreeNodeImageElement;
The obtained structure is null, and the version is 2025.

thaks

yw
Top achievements
Rank 2
Iron
Iron
 answered on 25 Aug 2025
1 answer
60 views

We have been using the TreeView in our software for some time now. However, recently, we noticed that it's not behaving as we have coded it. We had code that changed the Forcolor and Font when a node was selected. However, this doesn't seem to be working anymore. Attached is a sample code. Any help would be greatly appreciated.

 

FYI, we are using Telerik for Winforms: 2024.3.924.462

TIA



using System;
using System.Collections.Generic;
using System.Drawing;
using Telerik.WinControls;
using Telerik.WinControls.UI;

namespace TestNodeColorChange
{
   public partial class RadForm1 : Telerik.WinControls.UI.RadForm
   {
      #region Private Fields

      private string selectedNodeKey = string.Empty;

      #endregion Private Fields

      #region Public Constructors

      public RadForm1()
      {
         InitializeComponent();
         Load += FormLoading;
      }

      #endregion Public Constructors

      #region Private Methods

      private void FormLoading(object sender, EventArgs e)
      {
         List<TreeViewData> list = new List<TreeViewData>()
         {
            new TreeViewData { key = 1, DisplayValue = "Level 1" },
            new TreeViewData { key = 2, parentKey = 1, DisplayValue = "Branch A" },
            new TreeViewData { key = 3, parentKey = 1, DisplayValue = "Branch B" },
            new TreeViewData { key = 4, parentKey = 1, DisplayValue = "Branch C" }
         };

         radTreeView1.ChildMember = "key";
         radTreeView1.DisplayMember = "DisplayValue";
         radTreeView1.ParentMember = "parentKey";
         radTreeView1.DataSource = list;

         radTreeView1.ExpandAll();

         radTreeView1.SelectedNodeChanged += SelectedNodeChanged;
         radTreeView1.NodeFormatting += NodeFormatting;
      }

      private void NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
      {
         if (e.NodeElement is LightVisualElement lve)
         {
            lve.ResetValue(VisualElement.ForeColorProperty, ValueResetFlags.Local);
            lve.ResetValue(VisualElement.FontProperty, ValueResetFlags.Local);

            if (e.Node.Value.ToString() == selectedNodeKey)
            {
               lve.Font = new Font(lve.Font.FontFamily, lve.Font.Size, FontStyle.Bold);
               lve.ForeColor = Color.Purple;
               radTreeView1.NodeFormatting -= NodeFormatting;
               radTreeView1.Refresh();
               radTreeView1.NodeFormatting += NodeFormatting;
               Console.WriteLine("NodeFormatting: " + selectedNodeKey);
               Console.WriteLine("NodeFormatting: " + e.NodeElement.ForeColor.ToString());
               Console.WriteLine("NodeFormatting: " + ((e.NodeElement.Font.Style & FontStyle.Bold) != 0));
            }
         }
      }

      private void SelectedNodeChanged(object sender, RadTreeViewEventArgs e)
      {
         selectedNodeKey = e.Node.Value.ToString();
         Console.WriteLine("SelectedNodeChanged: " + selectedNodeKey);
         radTreeView1.Nodes.Refresh();
      }

      #endregion Private Methods

      #region Internal Classes

      internal class TreeViewData
      {
         #region Public Properties

         public string DisplayValue { get; set; }
         public int key { get; set; }
         public int? parentKey { get; set; }

         #endregion Public Properties
      }

      #endregion Internal Classes
   }
}

Nadya | Tech Support Engineer
Telerik team
 answered on 03 Apr 2025
1 answer
56 views

Hello,

is there any alternate available to apply specific theme directly on win form controls other than making a change in stylesheet (to apply different colors and appearance?) basically, for specific theme user wants to apply different color. one option is to create .tsp file and add it to resource. so is there any other way possible where user don't need to create. tsp or any other file and by using direct property he can achieve the same.  (controls like date time picker, calendar, tree view, Rad buttons etc.)

Thank you.

Dinko | Tech Support Engineer
Telerik team
 answered on 13 Mar 2025
1 answer
66 views

Hi,

Is it possible to override the colour and width of the horizontal drag / drop visual cue? If so can you give me an example ?

 

Cheers

Toby

Dinko | Tech Support Engineer
Telerik team
 answered on 04 Nov 2024
1 answer
116 views
Hello, can you please tell me how to properly localize radtreeview nodes text? The localization is working properly for other controls like rad menu items: In case of them, I only had to change the language property in parent RadForm, and set text property in particular language for that control and it worked fine. However, it cannot be done for tree nodes. For tree nodes I tried changing the language property in the parent form then opening the property builder where I set Text property. It turns out that the text set in this property is the text that is shown in all languages, not just in the one selected in the main form. So, how to do this?
Nadya | Tech Support Engineer
Telerik team
 answered on 16 Sep 2024
1 answer
122 views

Hello Team

How to set horizontal scroll position left most in the RadTreeView ?

Note: telerik version 2024.1.312.48

Attached screenshot for reference:

Thanks

Rajkannan

Dinko | Tech Support Engineer
Telerik team
 answered on 10 Jun 2024
1 answer
92 views

Hello,

We have a RadTreeView control inside a ToolWindow (with Dock = Fill) in a RadDock control. The nodes are added to the tree programmatically and AllowArbitraryItemHeight=false and TreeViewElement.AutoSizeItems=true. There is no ItemHeight set at all. We are sporadically getting an issue where the RadTreeView won’t let the user scroll to the bottom of the tree. We can’t consistently reproduce this error however. Is there any advice you can give how to try figure out what is going on?

Thanks,

Hayley

Nadya | Tech Support Engineer
Telerik team
 answered on 15 May 2024
1 answer
178 views
Hello,

I have a RadTreeView control and a RadDock control together in a WinForms app. The user needs to be able to drag a node from the RadTreeView to either the DocumentTabStrip part of RadDock or the control thats in a DocumentWindow. How do I tell which part of the RadDock the node is being dropped on? Im currently using the  TreeViewElement.DragDropService to handle the PreviewDragDrop method but the RadDropEventArgs.HitTarget gives me a RadPageViewStripElement regardless of where i drop the node. If I am dropping in the content area of the a document window (floating or docked) how do i get the actual DocumentWindow object itself?

Let me know if more information is required.

Thanks,

Hayley
Dinko | Tech Support Engineer
Telerik team
 answered on 21 Mar 2024
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?