开发者

ListView Losing Selection before Start Drag

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>
            &开发者_如何学编程lt;ListViewItem>5 - The 5th and only</ListViewItem>
            <ListViewItem>6 - The 6ht and only</ListViewItem>
        </ListView.Items>
</ListView>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜