Custom Items and Grouping

3 posts, 1 answers
  1. Hunter
    Hunter avatar
    44 posts
    Member since:
    Aug 2012

    Posted 17 Apr 2012 Link to this post

    Hello, I went through and created a custom visual item for my listview and everything worked out great (Telerik documentation was a big help). I then tried to apply custom grouping to my listview and no grouping appeard (everything loads, just without groups). After another quick look I realized that my custom item is also being applied to the group item (doh!). How would I go about determining the type of item being created int the VisualItemCreating event? Thanks
  2. Answer
    Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 20 Apr 2012 Link to this post

    Hello Hunter,

    Thank you for writing.

    The event arguments of the VisualItemCreating event contain the original visual item that will be used if you do not replace it. You can test its type to determine whether it is a group item or a regular item. The following code snippet demonstrates this:
    void radListView1_VisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e)
    {
        if (e.VisualItem is BaseListViewGroupVisualItem)
        {
            //creating group
        }
        else
        {
            //creating item
        }
    }

    I hope this will help you. Should you have any additional questions, do not hesitate to contact us.

    All the best,
    Ivan Todorov
    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
  4. Hunter
    Hunter avatar
    44 posts
    Member since:
    Aug 2012

    Posted 20 Apr 2012 Link to this post

    That's what I needed. Thank you :)
Back to Top