Leadtools.Windows.Controls Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.03.25
InteractiveMode Property
See Also  Example
Leadtools.Windows.Controls Namespace > BitmapSourceViewer Class : InteractiveMode Property





Gets or sets the value that controls user interaction with the control's display. This is a dependency property.

Syntax

Visual Basic (Declaration) 
Public Property InteractiveMode As BitmapSourceViewerInteractiveMode
Visual Basic (Usage)Copy Code
Dim instance As BitmapSourceViewer
Dim value As BitmapSourceViewerInteractiveMode
 
instance.InteractiveMode = value
 
value = instance.InteractiveMode
C# 
public BitmapSourceViewerInteractiveMode InteractiveMode {get; set;}
Managed Extensions for C++ 
public: __property BitmapSourceViewerInteractiveMode get_InteractiveMode();
public: __property void set_InteractiveMode( 
   BitmapSourceViewerInteractiveMode value
);
C++/CLI 
public:
property BitmapSourceViewerInteractiveMode InteractiveMode {
   BitmapSourceViewerInteractiveMode get();
   void set (BitmapSourceViewerInteractiveMode value);
}
XAML Attributes Usage 

<object InteractiveMode=Leadtools.Windows.Controls.BitmapSourceViewerInteractiveMode .../>

Dependency Property Information 

Identifier field

InteractiveModeProperty

Metadata properties set to true

None

Return Value

Value which controls the user interaction with the control's display.

Example

This example changes between different interactive modes -- from none, to pan, to magnifying glass, to Scale, and back to none.

Visual BasicCopy Code
Private Sub viewer_InteractiveModeChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of BitmapSourceViewerInteractiveMode))
   Dim viewer As BitmapSourceViewer = CType(IIf(TypeOf sender Is BitmapSourceViewer, sender, Nothing), BitmapSourceViewer)
   Dim s As String = String.Format("InteractiveMode changed to: {0}", viewer.InteractiveMode.ToString())
   MessageBox.Show(s)
End Sub
Public Sub BitmapSourceViewer_InteractiveMode(ByVal viewer As BitmapSourceViewer)
   AddHandler viewer.InteractiveModeChanged, AddressOf viewer_InteractiveModeChanged
   AddHandler viewer.InteractivePan, AddressOf viewer_InteractivePan

   Select Case viewer.InteractiveMode
      Case BitmapSourceViewerInteractiveMode.None
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Pan

      Case BitmapSourceViewerInteractiveMode.Pan
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.MagnifyGlass

      Case BitmapSourceViewerInteractiveMode.MagnifyGlass
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Geometry

      Case BitmapSourceViewerInteractiveMode.Geometry
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.ZoomTo

      Case BitmapSourceViewerInteractiveMode.ZoomTo
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.None

   End Select

   RemoveHandler viewer.InteractiveModeChanged, AddressOf viewer_InteractiveModeChanged
End Sub
C#Copy Code
private void viewer_InteractiveModeChanged(object sender, RoutedEventArgs e) 

   BitmapSourceViewer viewer = sender as BitmapSourceViewer; 
   string s = string.Format("InteractiveMode changed to: {0}", viewer.InteractiveMode.ToString()); 
   MessageBox.Show(s); 

public void BitmapSourceViewer_InteractiveMode(BitmapSourceViewer viewer) 

   viewer.InteractiveModeChanged+=new RoutedPropertyChangedEventHandler<BitmapSourceViewerInteractiveMode>(viewer_InteractiveModeChanged); 
   viewer.InteractivePan += new InteractivePanEventHandler(viewer_InteractivePan); 
 
   switch(viewer.InteractiveMode) 
   { 
      case BitmapSourceViewerInteractiveMode.None: 
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Pan; 
         break; 
 
      case BitmapSourceViewerInteractiveMode.Pan: 
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.MagnifyGlass; 
         break; 
 
      case BitmapSourceViewerInteractiveMode.MagnifyGlass: 
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.Geometry; 
         break; 
 
      case BitmapSourceViewerInteractiveMode.Geometry: 
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.ZoomTo; 
         break; 
 
      case BitmapSourceViewerInteractiveMode.ZoomTo: 
         viewer.InteractiveMode = BitmapSourceViewerInteractiveMode.None; 
         break; 
   } 
 
   viewer.InteractiveModeChanged -= new RoutedPropertyChangedEventHandler<BitmapSourceViewerInteractiveMode>(viewer_InteractiveModeChanged); 
}
XAMLCopy Code
<Window x:Class="WPFSamples.BitmapSourceViewer" Height="600" Width="800" Title="InteractiveMode Sample" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Leadtools_Windows_Controls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"> 
  <DockPanel> 
    <Leadtools_Windows_Controls:BitmapSourceViewer Name="theViewer" Source="file:///C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\slave.jpg" DockPanel.Dock="Bottom" HorizontalAlignment="Center" VerticalAlignment="Center" InteractiveMode="Scale" InteractiveModeChanged="viewer_InteractiveModeChanged" /> 
  </DockPanel> 
</Window>

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, and Windows Server 2003 family

See Also