I am having some difficulty when I use the Josh Smith's issue for DnD on listView.
I have an ObservableCollection of "DetailTable" that I initialize in the ViewModel when I create the view :
(ListeTables is CollectionViewSource where I initialize and use my data)
public ObservableCollection<DetailTable> ListeTablesDisplay
{
get
{
var l = ListeTables.View.Cast<DetailTable>().ToList();
return new ObservableCollection<DetailTable>(l);
}
}
The listView in the Xaml file :
<ListView Name="ListeViewTables" SelectionMode="Single"
AllowDrop="true"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemsSource="{Binding ListeTablesDisplay, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedTable, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Margin="10,83,831,61">
And then I call the Class of Josh Smith for the DnD in the View CodeBehind :
public DataView()
{
InitializeComponent();
new ListViewDragDropManager<DetailTable>(this.ListeViewTables);
}
Until now, the drag and drop work correctly, but in the ViewModel the order of items of the ObservableCollection is not coherent with what I do in the View.
Example : if I move the item-3 to the 5th position, it's ok with the View but when I debug I see the item-3 always to the 3rd position in my ObservableCollection.
It's very problematic for what I want to do, I hope someone can help me !
Thanks