or

This must be simple, but I have trouble to get this solved ...
I have a mouse click event proc of which the sender type is a RadTextBoxItem. I need to know the textbox, so type TextBox or RadTextBox. How can this be done?


public class MyCustomVisualItem : SimpleListViewVisualItem { private LightVisualElement _contentElementName; private LightVisualElement _contentElementState; private StackLayoutPanel _stackLayoutH; private StackLayoutPanel _stackLayoutV; private ImagePrimitive _image1; protected override void CreateChildElements() { base.CreateChildElements(); _stackLayoutH = new StackLayoutPanel { Orientation = Orientation.Horizontal, EqualChildrenWidth = false }; _stackLayoutV = new StackLayoutPanel { Orientation = Orientation.Vertical, EqualChildrenWidth = true, Margin = new Padding(10,0,0,0) }; _image1 = new ImagePrimitive { Image = (Image)Resource1.ResourceManager.GetObject("Anonymous"), Alignment = ContentAlignment.MiddleLeft }; _stackLayoutH.Children.Add(_image1); _contentElementName = new LightVisualElement { StretchHorizontally = true, Alignment = ContentAlignment.MiddleLeft, ImageAlignment = ContentAlignment.MiddleLeft, TextAlignment = ContentAlignment.MiddleLeft, Image = (Image)Resource1.ResourceManager.GetObject("Untitled_1s"), TextImageRelation = TextImageRelation.ImageBeforeText }; _stackLayoutV.Children.Add(_contentElementName); _contentElementState = new LightVisualElement { StretchHorizontally = true, Alignment = ContentAlignment.MiddleLeft, TextAlignment = ContentAlignment.MiddleLeft, ForeColor = Color.Gray, }; _stackLayoutV.Children.Add(_contentElementState); _stackLayoutH.Children.Add(_stackLayoutV); Children.Add(_stackLayoutH); } protected override void SynchronizeProperties() { base.SynchronizeProperties(); Text = ""; _contentElementName.Text = Convert.ToString(Data["Name"]); _contentElementState.Text = "Life is Good"; } protected override Type ThemeEffectiveType { get { return typeof(SimpleListViewVisualItem); } } }
Action radListView1_SelectedItemChanged in ListView doesn't work when i click on LightVisualElement element in my custom ListView item.public RadForm1() { InitializeComponent(); this.radListView1.Columns.Add("Name"); this.radListView1.Items.Add(new ListViewDataItem("text")); this.radListView1.Items[0]["Name"] = "User"; } private void radListView1_VisualItemCreating(object sender, Telerik.WinControls.UI.ListViewVisualItemCreatingEventArgs e) { e.VisualItem = new MyCustomVisualItem(); } private void radListView1_SelectedItemChanged(object sender, EventArgs e) { int s = 2; }

private void radButtonElementEnglish_Click(object sender, EventArgs e){ ChangeLanguage(this, "English")}public void ChangeLanguage(Form frm, String Language = "English"){ RadTextBox RadTextBoxTip = null; RadDropDownListCustom radDropDownListCustomTip = null; RadLabel radLabelTip = null; RadButtonElement radButtonElementTip = null; RadGridView radGridViewTip = null; SqlCommand commandGetData = null; try { commandGetData = SQLQuery(); commandGetData.CommandText = "SELECT Element_Name, Element_Typ, Element_Text_EN, ToolTip_Text_EN, Element_Text_DE, ToolTip_Text_DE, From Language WHERE Windowr_Name = @Window_Name"; commandGetData.Parameters.AddWithValue("@Window_Name", frm.Name.ToString()); commandGetData.Connection.Open(); SqlDataReader DataReader = commandGetData.ExecuteReader(); if (DataReader.HasRows) { while (DataReader.Read()) { switch (DataReader["Element_Typ"].ToString()) { case ("radTextBox"): RadTextBoxTip = (RadTextBox)frm.Controls.Find(DataReader["Element_Name"].ToString(), true)[0]; if (Language == "English") { RadTextBoxTip.Text = DataReader["Element_Text_EN"].ToString(); RadTextBoxTip.TextBoxElement.TextBoxItem.ToolTipText = DataReader["ToolTip_Text_EN"].ToString(); } if (Language == "German") { RadTextBoxTip.Text = DataReader["Element_Text_DE"].ToString(); RadTextBoxTip.TextBoxElement.TextBoxItem.ToolTipText = DataReader["ToolTip_Text_DE"].ToString(); } break; case ("radLabel"): radLabelTip = (RadLabel)frm.Controls.Find(DataReader["Element_Name"].ToString(), true)[0]; // same as radtextbox //radLabelTip.Text //radLabelTip.LabelElement.ToolTipText break; case ("radRibbonbonbar"): //.. RadRibbonBar RadRibbonbarTip = (RadRibbonBar)frm.Controls.Find(DataReader["Element_Name"].ToString(), true)[0]; //RadRibbonbarTip.Text = .. //No Tooltip here break; case ("ribbonTab"): //.. break; case ("radButtonElement"): var c = GetAll(frm, typeof(RadRibbonBar)); MessageBox.Show("Total Controls: " + c.Count()); break; //more case: default: break; } } DataReader.NextResult(); } commandGetData.Connection.Close(); } catch (System.Data.SqlClient.SqlException ex) { // showEvents(ex); } finally { if (commandGetData != null) { commandGetData.Dispose(); } } } }public IEnumerable<Control> GetAll(Control control, Type type){ var controls = control.Controls.Cast<Control>(); return controls.SelectMany(ctrl => GetAll(ctrl, type)) .Concat(controls) .Where(c => c.GetType() == type);}