I create new item class
add to item creating
When click on free space in the item or on ImagePrimitive element all work and selected item changing.
How can i fix it?
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); } } }
add to item creating
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; }
When click on free space in the item or on ImagePrimitive element all work and selected item changing.
How can i fix it?