This is a migrated thread and some comments may be shown as answers.

Move DescriptionTextListDataItem Separator Line

1 Answer 82 Views
ListControl
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 24 Oct 2012, 06:49 PM
I'm currently using a RadDropDownList with a set of DescriptionTextListDataItems in DropDownList mode and it looks great except that it's drawing a thin gray separator line between the item text and the item description like this:

Text
----------
Description
Text
----------
Description


Is there a way to remove this separator line and to have a separator line between the list items? What I'm looking for is something like this:

Text
Description
----------
Text
Description

I'm not sure the way I'm doing it now is correct or the preferred way.

private void SearchTypeList_CreatingVisualListItem(object sender, CreatingVisualListItemEventArgs e)
{
    e.VisualItem.BorderColor = SystemColors.Control;
    //e.VisualItem.Children[0].Children[1].Children[1].ShouldPaint = false;
 
    foreach(var child in e.VisualItem.Children)
    {
        if(child is StackLayoutElement)
        {
            foreach(var child1 in child.Children)
            {
                if(child1 is StackLayoutElement)
                {
                    foreach(var child2 in child1.Children)
                    {
                        if(child2 is LinePrimitive)
                        {
                            child2.ShouldPaint = false;
                            return;
                        }
                    }
                }
            }
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 29 Oct 2012, 02:41 PM
Hi Gregory,

Thank you for writing.

You should set the DescriptionTextListVisualItem Visibility property to Hidden. Suitable place to do this is VisualListItemFormatting event. For example:
this.radDropDownList1.VisualListItemFormatting += new Telerik.WinControls.UI.VisualListItemFormattingEventHandler(radDropDownList1_VisualListItemFormatting);
 
void radDropDownList1_VisualListItemFormatting(object sender, Telerik.WinControls.UI.VisualItemFormattingEventArgs args)
{
            DescriptionTextListVisualItem item = args.VisualItem as DescriptionTextListVisualItem;
            if (item != null)
            {
                item.Separator.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
            }
}

I hope this helps. Greetings,
Peter
the Telerik team
Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
ListControl
Asked by
Greg
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or