Reorder RadListBox

2 posts, 0 answers
  1. Kathryn
    Kathryn avatar
    1 posts
    Member since:
    Jun 2016

    Posted 05 Aug 2016 Link to this post

    I am trying to implement a RadListBox that allows users to reorder the items within itself.  While I have found some old examples of this as well as the sdk examples, I keep getting the following error when I include the ItemContainerStyle reference:

    "A style intended for type 'Telerik_Windows_Controls_RadListBox_0_206042439' cannot be applied to type 'ContentPresenter'.


    In my XAML, I have this:


            <vm:AgentPreferencesViewModel x:Key="ViewModel" />
            <cnv:CheckBoxConverter x:Key="CheckBoxConverter" />
            <Style TargetType="telerik:RadListBox" x:Key="DraggableItem">
                <Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
                <Setter Property="telerik:RadDragAndDropManager.AllowDrop" Value="True" />
                <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True"/>


    <telerik:RadListBox ItemContainerStyle="{StaticResource DraggableItem}"
                                ItemsSource="{Binding GridHeaders}"
                        <telerik:ScreenshotDragVisualProvider />
                        <telerik:ListBoxDragDropBehavior AllowReorder="True" />

  2. Yana
    Yana avatar
    4602 posts

    Posted 08 Aug 2016 Link to this post

    Hi Kathryn,

    The Style set to ItemContainerStyle property of RadListBox should have its TargetType set to
    RadListBoxItem (not RadListBox). 

    I'd suggest you check the Drag and Drop Overview topic in our documentation as well as the ListBox Drag and Drop example at WPF Demos.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top