Group can be selected

2 posts, 0 answers
  1. ZT885048
    ZT885048 avatar
    3 posts
    Member since:
    Apr 2012

    Posted 18 Apr 2012 Link to this post

    Hello

    I have my data added like this way Added for items and two groups and assigned as below.
    this.radListView1.Groups.Add(new ListViewDataItemGroup("First Group"));
    this.radListView1.Groups.Add(new ListViewDataItemGroup("Second Group"));
     
    this.radListView1.Items[0].Group = this.radListView1.Groups[0];
    this.radListView1.Items[1].Group = this.radListView1.Groups[0];
    this.radListView1.Items[2].Group = this.radListView1.Groups[1];
    this.radListView1.Items[3].Group = this.radListView1.Groups[1];
    If I wanted to select the first Group "First Group" and on basis for that i wanted to show message or call any other event...
    How can i do that ?
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 20 Apr 2012 Link to this post

    Hello,

    Thank you for writing.

    I am not quite sure that I understand your requirement, however, I assume that you want to detect when the user have clicked the group header, so you can perform some action. If this is so, you need to handle the MouseDown event of RadListView and check the clicked item type. Here is a sample:
    void radListView1_MouseDown(object sender, MouseEventArgs e)
    {
        SimpleListViewGroupVisualItem element = radListView1.ElementTree.GetElementAtPoint(e.Location) as SimpleListViewGroupVisualItem;
     
        if (element != null)
        {
            RadMessageBox.Show(element.Text + " clicked");
        }
    }

    If this is not the case, please provide me with additional details regarding the desired functionality.
     
    Kind regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top