Infragistics(R) NetAdvantage(R) WPF
Moving Event
See Also  Example E-mail your feedback on this topic.
Infragistics.Controls.Interactions Namespace > XamDialogWindow Class : Moving Event

Glossary Item Box

Occurs when a XamDialogWindow starting to move.

Syntax

Visual Basic (Declaration) 
Public Event Moving As EventHandler(Of MovingEventArgs)
C# 
public event EventHandler<MovingEventArgs> Moving

Event Data

The event handler receives an argument of type MovingEventArgs containing data related to this event. The following MovingEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from Infragistics.CancellableEventArgs) Gets/sets if the event should be cancelled.
Left Gets or sets the Left coordinate property
Top Gets or sets the Top coordinate property

Example

The moment right before the dialog window is moved, the Moving event fires. This event can be cancelled if certain conditions are not met.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Visual BasicCopy Code
AddHandler DialogWindow.Moving, AddressOf DialogWindow_Moving

Private Sub DialogWindow_Moving(ByVal sender As System.Object, ByVal e As MovingEventArgs)
   'Don't allow the dialog window to move more than 200 pixels 
   If (e.Left > 200) Then
      e.Cancel = True
      System.Diagnostics.Debug.WriteLine("Moving Cancelled")
      Return
   End If
   System.Diagnostics.Debug.WriteLine("Dialog Window Moving Successfully")
End Sub
C#Copy Code
DialogWindow.Moving += new EventHandler<MovingEventArgs>(DialogWindow_Moving);
...
void DialogWindow_Moving(object sender, MovingEventArgs e)
{
    //Don't allow the dialog window to move more than 200 pixels 
   if (e.Left > 200)
   {
      e.Cancel = true;
      System.Diagnostics.Debug.WriteLine("Moving Cancelled");
      return;
   }
   System.Diagnostics.Debug.WriteLine("Dialog Window Moving Successfully");
}
XAMLCopy Code
<Grid x:Name="LayoutRoot" Background="White">
   
<ig:XamDialogWindow Content="Dialog Window" 
      
x:Name="DialogWindow" Width="200" Height="200" 
      
Moving="DialogWindow_Moving"/>
</Grid>

See Also