views:

28

answers:

1

I got a ListView Like the following. The User is supposed to select some Items and dragDrop to somewhere else. This does not require CTRL+click which is good. but after all the selection are made, when I try to start drag, the left click un-selects teh item that got clicked. How can I make this behave like windows explorer, so the selection dont change when I start a drag with mouse. I wasted quite a bit of time, tried some claimed solutions out there, like one was to sub class both the ListView and ListViewItem and messing with the PreviewMouseLeftButtonDown but nothing has worked for me. TIA!

<ListView SelectionMode="Multiple" Grid.Column="1" >
        <ListView.View>
            <GridView>
                <GridViewColumn Width="25">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListViewItem, AncestorLevel=1}}" />
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <GridViewColumn Width="200" />
            </GridView>
        </ListView.View>
        <ListView.Items>
            <ListViewItem>1 - The one and only</ListViewItem>
            <ListViewItem>2 - The second and only</ListViewItem>
            <ListViewItem>3 - The third and only</ListViewItem>
            <ListViewItem>4 - The 4th and only</ListViewItem>
            <ListViewItem>5 - The 5th and only</ListViewItem>
            <ListViewItem>6 - The 6ht and only</ListViewItem>
        </ListView.Items>
</ListView>
+1  A: 

I just bumped into the answer here, and works nice. A zillion thanks to all the guys there!