Well im trying to make my own basic Slider control just so i can learn abit how to interact with the mouse...
so far i have this:
vb.net:
Private Sub Rectangle_MouseMove(ByVal sender as Object, ByVal e as System.Windows.Input.MouseEventArgs)
If (e.LeftButton = MouseButtonState.Pressed) Then
Dim p As Point = Mouse.GetPosition(Me)
Rectangle.SetValue(FrameworkElement.MarginProperty, New Thickness(p.X - Rectangle.Width / 2, 0, 0, 0))
End If
End Sub
Private Sub Rectangle_MouseDown(ByVal sender as Object, ByVal e as System.Windows.Input.MouseButtonEventArgs)
End Sub
Private Sub Rectangle_MouseUp(ByVal sender as Object, ByVal e as System.Windows.Input.MouseButtonEventArgs)
End Sub
xaml:
<Rectangle x:Name="Rectangle" Fill="White" Stroke="Black" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" Width="100" Height="75" MouseMove="Rectangle_MouseMove" MouseDown="Rectangle_MouseDown" MouseUp="Rectangle_MouseUp"/>
so this works while the mouse is on the rectangle.. but if we look how the slider behaves its not the same you click and hold the mouse down and can drag it any where even outside of the window and it still updates its position..
So how is this done? my guess is its the Mouse Class but i don't understand how to use it.