Version: 2009.3.1314.35
This is based off a sample you put up describing how to change the index of the sort
Here is what I have in XAML and in code:
<
<Telerik:RadTreeView x:Name="treeColumns" MinHeight="500" DragEnded="treeColumns_DragEnded"
VerticalAlignment="Top" SelectionMode="Multiple" IsEditable="True" IsDragDropEnabled="True"
ItemTemplate="{StaticResource ItemTemplate}"
ItemsSource="{Binding Converter={StaticResource convWorkflow}}"></Telerik:RadTreeView>
treeColumns.DragEnded +=
new RadTreeViewDragEndedEventHandler(treeColumns_DragEnded);
private void treeColumns_DragEnded(object sender, RadTreeViewDragEndedEventArgs e)
{
int index;
WorkFlow draggedItem = e.DraggedItems[0] as WorkFlow;
WorkFlow targetItem=e.TargetDropItem.DataContext as WorkFlow;
if (draggedItem != targetItem)
{
switch (e.DropPosition)
{
case DropPosition.After:
index = e.TargetDropItem.Index + 1;
break;
case DropPosition.Before:
index = e.TargetDropItem.Index - 1;
break;
case DropPosition.Inside:
index = e.TargetDropItem.Items.IndexOf(draggedItem);
break;
default:
index = -1;
break;
}
}
else
{
index = e.TargetDropItem.Index;
}
draggedItem.SortOrder = index;
DataAccess.ctx.SubmitChanges();
}