Click here to Skip to main content
15,895,011 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF and MVVM pattern question Pin
babongita18-Feb-09 8:59
babongita18-Feb-09 8:59 
GeneralRe: WPF and MVVM pattern question Pin
Pete O'Hanlon18-Feb-09 9:09
mvePete O'Hanlon18-Feb-09 9:09 
GeneralRe: WPF and MVVM pattern question Pin
babongita18-Feb-09 10:02
babongita18-Feb-09 10:02 
GeneralRe: WPF and MVVM pattern question Pin
Pete O'Hanlon18-Feb-09 10:16
mvePete O'Hanlon18-Feb-09 10:16 
GeneralRe: WPF and MVVM pattern question Pin
Pete O'Hanlon19-Feb-09 21:52
mvePete O'Hanlon19-Feb-09 21:52 
GeneralRe: WPF and MVVM pattern question Pin
babongita20-Feb-09 2:42
babongita20-Feb-09 2:42 
GeneralRe: WPF and MVVM pattern question Pin
Pete O'Hanlon20-Feb-09 3:35
mvePete O'Hanlon20-Feb-09 3:35 
QuestionWPF ListView Databound Drag/Drop Auto Scroll Pin
snblackout18-Feb-09 4:25
snblackout18-Feb-09 4:25 
Hi there, I've been working with Bea's solution here for a while and finding it very helpful. Problem now I'm having is when I drag-n-drop items within or to another ListView control and I want to scroll up/down "during" the drag (moving an item from index 30 to index 1), it's not happening. I would have to drag to the top of the visual items in the ListView, manually scroll up, then drag again, eventually ending at the position I want. This isn't very user friendly.

Now I found the function (DragDropHelper.DropTarget_PreviewDragOver) that I would want to do the testing of which item is being dragged over, and I'm getting that.

<br />
    Dim pt As Point = e.GetPosition(DirectCast(Me.targetItemsControl, UIElement))<br />
<br />
    ' Perform the hit test against a given portion of the visual object tree.<br />
    Dim result As HitTestResult = VisualTreeHelper.HitTest(Me.targetItemsControl, pt)<br />


Now from there I can get the DependencyProperty of this visual hit

<br />
    Dim lvi As ListViewItem = TryCast(GetDependencyObjectFromVisualTree(TryCast(result.VisualHit, DependencyObject), GetType(ListViewItem)), ListViewItem)<br />


Which is of a ListViewItem. Now in the function DropTarget_PreviewDragOver I have the "DraggedItem" which is of type Picture in Bea's example, but that can change depending on the ObservableCollection you have bound to the ListView. Now, I want to drag the ListView up or down depending on where the mouse is on the control. I've attempted with the below un-finished non-working code

<br />
    If lvi IsNot Nothing Then<br />
        If pt.Y <= 25 Then<br />
            Dim lv As ListView = TryCast(targetItemsControl, ListView)<br />
            If lv IsNot Nothing Then<br />
                Dim index As Integer = lv.Items.IndexOf(lvi)<br />
                If index > 1 Then<br />
                    lv.ScrollIntoView(lv.Items(index - 1))<br />
                End If<br />
            End If<br />
        Else<br />
            If pt.Y >= Me.targetItemsControl.ActualHeight - 25 Then<br />
                Debug.Print("Scroll Down")<br />
            End If<br />
        End If<br />
    End If<br />


Can someone point me in the right direction to get this ItemsControl or ListView to scroll when dragging over the items??

Thanks!
QuestionWPF System.Security.Permissions.SecurityPermission winmm.dll Pin
Member 216927318-Feb-09 0:01
Member 216927318-Feb-09 0:01 
AnswerRe: WPF System.Security.Permissions.SecurityPermission winmm.dll [modified] Pin
sivaddrahcir18-Feb-09 13:00
sivaddrahcir18-Feb-09 13:00 
QuestionCreate Role Pin
VisualLive17-Feb-09 22:19
VisualLive17-Feb-09 22:19 
AnswerRe: Create Role Pin
VisualLive18-Feb-09 14:46
VisualLive18-Feb-09 14:46 
QuestionDataContract and ISerializable not friendly Pin
devvvy17-Feb-09 21:02
devvvy17-Feb-09 21:02 
AnswerRe: DataContract and ISerializable not friendly Pin
Pete O'Hanlon17-Feb-09 21:51
mvePete O'Hanlon17-Feb-09 21:51 
GeneralRe: DataContract and ISerializable not friendly Pin
devvvy18-Feb-09 0:59
devvvy18-Feb-09 0:59 
GeneralRe: DataContract and ISerializable not friendly Pin
Pete O'Hanlon18-Feb-09 2:06
mvePete O'Hanlon18-Feb-09 2:06 
QuestionProblem with user control Pin
Soham Dasgupta17-Feb-09 17:42
Soham Dasgupta17-Feb-09 17:42 
QuestionWPF treeview control problem Pin
ramakrishnamakkena17-Feb-09 17:02
ramakrishnamakkena17-Feb-09 17:02 
AnswerRe: WPF treeview control problem Pin
ABitSmart17-Feb-09 23:26
ABitSmart17-Feb-09 23:26 
QuestionProperty pages Pin
Jozef Hopko17-Feb-09 11:08
Jozef Hopko17-Feb-09 11:08 
AnswerRe: Property pages Pin
Pete O'Hanlon17-Feb-09 11:18
mvePete O'Hanlon17-Feb-09 11:18 
QuestionDrawing own Picture and set it to Control Pin
ezazazel17-Feb-09 6:09
ezazazel17-Feb-09 6:09 
AnswerRe: Drawing own Picture and set it to Control [modified] Pin
sivaddrahcir18-Feb-09 10:58
sivaddrahcir18-Feb-09 10:58 
GeneralRe: Drawing own Picture and set it to Control Pin
ezazazel18-Feb-09 11:27
ezazazel18-Feb-09 11:27 
GeneralRe: Drawing own Picture and set it to Control Pin
Mark Salsbery19-Feb-09 6:35
Mark Salsbery19-Feb-09 6:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.