Question how to detect mouse button state during DragDrop

Snowflake

Member
Joined
Sep 16, 2014
Messages
15
Programming Experience
Beginner
I am new to WPF and am having a few problems detecting whether the left or right button is pressed during a DragEnter event.
I was expecting a MsgBox to appear but I get nothing.
Thanks for any help


XAML Code
VB.NET:
   <Grid>
        <Button x:Name="btn1" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="329" Margin="88,94,0,0" Height="113" AllowDrop="True"/>

   </Grid>

Event Code
VB.NET:
    Private Sub btn1_DragEnter(sender As Object, e As DragEventArgs) Handles btn1.DragEnter
        If Input.Mouse.LeftButton = MouseButtonState.Pressed Then
            MsgBox(1)
        ElseIf Input.Mouse.RightButton = MouseButtonState.Pressed Then
            MsgBox(2)
        End If
    End Sub
 

Latest posts

Back
Top