How to add title (like group header) in the telerik's radlistbox

1.4k Views Asked by At

Code:

<telerik:RadListBox x:Name="testStates">

</telerik:RadListBox>

I searched and not found a proper way to add a header / title in the radlistbox.

How to add title / header (like group header in asp.net ajax telerik control radlistbox) in the telerik's radlistbox in wpf ?

Can we achieve the solution by any other way if we can't able to do it in a recommended way?

1

There are 1 best solutions below

2
On

Answer relates to the AJAX and not WPF controls, however have left code here for reference purposes and/or until a suitable WPF solution is found

According to the Telerik Forum:

RadListBox does not support such Group (Header) Items out-of-the-box.

The only way you could achieve something similar to the headers is by using an ItemTemplate and using the (undocumented) SelectedIndexChanging including the code to cancel the event should the user attempt to select it (the following code has not been syntax or error checked and should probably only be used as a guideline)

function jsEventHandler(sender,eventArgs) {
    var selectedItem = eventArgs.get_item(); // gets the selected item
    if(/*Insert code for determining whether the item is a "header item"*/){
        eventArgs.set_cancel(true);
    }
}

You'll find your answer in this Telerik Forum Post