Data Converter Not Getting Called

3 posts, 0 answers
  1. Brett
    Brett avatar
    15 posts
    Member since:
    Sep 2010

    Posted 15 Apr 2013 Link to this post

    I created the a custom class using the steps in the documentation to convert data when dragging and dropping.  For some reason, this code is never called and the conversion never happens.  I set breakpoints in the class and they are never hit.  I don't know what I need to do to get the converter to work.  Could someone please help me figure out why the code in the convert class isn't getting called?

    Thank you.

    Here is the XAML:
    <DataTemplate x:Key="LoadBoardListBoxItemTemplate">
                <StackPanel Orientation="Vertical" Background="{Binding ColorCode, Converter={StaticResource ColorConverter}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <TextBlock Text="{Binding Company.Name}" Margin="3" Foreground="White" Width="200" FontSize="12" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                    <TextBlock Text="{Binding Name}" Margin="3" FontSize="12" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Turn Time" FontSize="12" Margin="3" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                        <TextBlock Text="{Binding TurnTime}" FontSize="12" Margin="3" Foreground="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
    <Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem">
                <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />

                ItemsSource="{Binding Trips, Mode=TwoWay}"
                IsEnabled="{Binding ListEnabled, Mode=TwoWay}"
                ItemContainerStyle="{StaticResource DraggableListBoxItem}"
                ItemTemplate="{StaticResource LoadBoardListBoxItemTemplate}"
                    <telerik:ScreenshotDragVisualProvider />
                    <telerik:ListBoxDragDropBehavior AllowReorder="True" />
                    <drag:TripToActualTripConverter />

    This is the C# class:
    public class TripToActualTripConverter : DataConverter
            public override string[] GetConvertToFormats()
                return new string[] { typeof(Trip).FullName, typeof(ActualTrip).FullName };
            public override object ConvertTo(object data, string format)
                var payload = (IEnumerable)DataObjectHelper.GetData(data, typeof(Trip), false);
                if (payload != null)
                    return payload.OfType<Trip>().Select(t => new ActualTrip
                        Company = t.Company,
                        CompanyId = t.CompanyId,
                        Trip = t,
                        TripId = t.TripId,
                        ActualDate = DateTime.Now,
                        TicketNumber = string.Empty,
                        TripNumber = string.Empty,
                        ActualTons = 0,
                        Label = t.Name
                return null;

  2. Vladi
    Vladi avatar
    749 posts

    Posted 19 Apr 2013 Link to this post


    We are not aware of any issues concerning data conversion between two RadListBox controls. All you need to do is create to separate DataConverter for each ListBox control and in those converters override the ConvertTo and GetConvertToFormats methods.

    I created and attached a sample project for you that shows for to create those DataConverters, hope this is helpful.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Brett
    Brett avatar
    15 posts
    Member since:
    Sep 2010

    Posted 30 Apr 2013 Link to this post

    Sorry for the late reply.  Thank you for sending me the sample.  I was able to get my code working by following the example.
Back to Top