Window.DragMove : Window Event « Windows Presentation Foundation « VB.Net Tutorial






<Window x:Class="GadgetWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Height="300" Width="300"
  AllowsTransparency="True" WindowStyle="None" Background="Transparent"
  MouseLeftButtonDown="Window_MouseLeftButtonDown">
  <Grid>
    <Ellipse Fill="Red" Opacity="0.5" Margin="20">
      <Ellipse.BitmapEffect>
        <DropShadowBitmapEffect/>
      </Ellipse.BitmapEffect>
    </Ellipse>
    <Button Margin="100" Click="Button_Click">Close</Button>
  </Grid>
</Window>
//File:Window.xaml.vb

Imports System.Windows
Imports System.Windows.Input

Public Partial Class GadgetWindow
  Inherits Window
  Public Sub New()
    InitializeComponent()
  End Sub
  Private Sub Window_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs)
    Me.DragMove()
  End Sub
  Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    Me.Close()
  End Sub
End Class
WPF Window Drag Move








16.58.Window Event
16.58.1.Window.CommandBindingsWindow.CommandBindings
16.58.2.Window.DragMoveWindow.DragMove
16.58.3.Listen to Window loaded eventListen to Window loaded event
16.58.4.Create Window and add window closing event handlerCreate Window and add window closing event handler
16.58.5.Activate window, close window, bring window to frontActivate window, close window, bring window to front
16.58.6.Window Preview Key EventsWindow Preview Key Events
16.58.7.Window On Mouse move eventWindow On Mouse move event
16.58.8.Window On Mouse up eventWindow On Mouse up event
16.58.9.Window mouse down eventWindow mouse down event
16.58.10.Window Preview mouse down eventWindow Preview mouse down event
16.58.11.Window mouse up eventWindow mouse up event
16.58.12.Close a window with Escape key pressedClose a window with Escape key pressed
16.58.13.Window Closing and Closed eventWindow Closing and Closed event