Error processing SSI file
LEADTOOLS WPF and Silverlight (Leadtools.Windows.Controls assembly)

Show in webframe

OnSourceChanged Method (ImagePanViewer)






A RoutedPropertyChangedEventArgs that contains the event data.
Raises the SourceChanged event.
Syntax
protected virtual void OnSourceChanged( 
   RoutedPropertyChangedEventArgs<ImageViewer> e
)
'Declaration
 
Protected Overridable Sub OnSourceChanged( _
   ByVal e As RoutedPropertyChangedEventArgs(Of ImageViewer) _
) 
'Usage
 
Dim instance As ImagePanViewer
Dim e As RoutedPropertyChangedEventArgs(Of ImageViewer)
 
instance.OnSourceChanged(e)

            

            
protected:
virtual void OnSourceChanged( 
   RoutedPropertyChangedEventArgs<ImageViewer^>^ e
) 

Parameters

e
A RoutedPropertyChangedEventArgs that contains the event data.
Remarks

Raising an event invokes the event handler through a delegate.

The OnSourceChanged method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors: When overriding OnSourceChanged in a derived class, be sure to call the base class's OnSourceChanged method so that registered delegates receive the event.

Example
Copy Code  
Imports Leadtools.Windows.Controls

Public Sub ImagePanViewer_SourceChanged(ByVal panViewer As ImagePanViewer)
    ' set up the event handlers
    AddHandler panViewer.StrokeChanged, AddressOf panViewer_StrokeChanged
    AddHandler panViewer.SourceChanged, AddressOf panViewer_SourceChanged
    AddHandler panViewer.InnerBrushChanged, AddressOf panViewer_InnerBrushChanged
    AddHandler panViewer.OuterBrushChanged, AddressOf panViewer_OuterBrushChanged
    AddHandler panViewer.PositionChanged, AddressOf panViewer_PositionChanged
    Dim viewerOld As ImageViewer = panViewer.Source
    ' fires the SourceChanged event twice
    panViewer.Source = Nothing
    panViewer.Source = viewerOld

    ' change some properties
    panViewer.Stroke = Brushes.Black
    panViewer.StrokeThickness = 2

    panViewer.Position = New Point(20, 20)
End Sub

Private Sub panViewer_PositionChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Point))
    Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
    If Not panViewer Is Nothing Then
        Console.WriteLine("Position Changed to " & panViewer.Position.ToString())
    End If
End Sub

Private Sub panViewer_OuterBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
    Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
    If Not panViewer Is Nothing Then
        Console.WriteLine("Inner Brush Changed to " & panViewer.OuterBrush.ToString() & "Color")
    End If
End Sub

Private Sub panViewer_InnerBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
    Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
    If Not panViewer Is Nothing Then
        Console.WriteLine("Inner Brush Changed to " & panViewer.InnerBrush.ToString() & "Color")
    End If
End Sub

Private Sub panViewer_StrokeChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
    Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
    If Not panViewer Is Nothing Then
        Console.WriteLine("Rectangle Stroke Changed to " & panViewer.StrokeThickness.ToString() & "Thickness and to" & panViewer.Stroke.ToString() & "Color")
    End If
End Sub

Private Sub panViewer_SourceChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of ImageViewer))
    Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
    If Not panViewer Is Nothing Then
        If panViewer.Source Is Nothing Then
            Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control")
        Else
            Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control")
        End If
    End If
End Sub
using Leadtools.Help;
using Leadtools.Windows.Controls;

public void ImagePanViewer_SourceChanged(ImagePanViewer panViewer)
{
   // set up the event handlers
   panViewer.StrokeChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_StrokeChanged);
   panViewer.SourceChanged += new RoutedPropertyChangedEventHandler<ImageViewer>(panViewer_SourceChanged);
   panViewer.InnerBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(panViewer_InnerBrushChanged);
   panViewer.OuterBrushChanged +=new RoutedPropertyChangedEventHandler<Brush>(panViewer_OuterBrushChanged);
   panViewer.PositionChanged += new RoutedPropertyChangedEventHandler<Point>(panViewer_PositionChanged);
   ImageViewer viewerOld = panViewer.Source;
   // fires the SourceChanged event twice
   panViewer.Source = null;
   panViewer.Source = viewerOld;

   // change some properties
   panViewer.Stroke = Brushes.Black;
   panViewer.StrokeThickness = 2;

   panViewer.Position = new Point(20, 20);
}

void panViewer_PositionChanged(object sender, RoutedPropertyChangedEventArgs<Point> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Position Changed to " + panViewer.Position.ToString());
}

void panViewer_OuterBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Inner Brush Changed to " + panViewer.OuterBrush.ToString() + "Color");
}

void panViewer_InnerBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Inner Brush Changed to " + panViewer.InnerBrush.ToString() + "Color");
}

private void panViewer_StrokeChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if(panViewer != null)
      Console.WriteLine("Rectangle Stroke Changed to " + panViewer.StrokeThickness.ToString() +"Thickness and to"  + panViewer.Stroke.ToString()+ "Color");
}

private void panViewer_SourceChanged(object sender, RoutedPropertyChangedEventArgs<ImageViewer> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if(panViewer != null)
   {
      if(panViewer.Source == null)
         Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control");
      else
         Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control");
   }
}
using Leadtools.Help;
using Leadtools.Windows.Controls;

public void ImagePanViewer_SourceChanged(ImagePanViewer panViewer)
{
   // set up the event handlers
   panViewer.StrokeChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_StrokeChanged);
   panViewer.SourceChanged += new RoutedPropertyChangedEventHandler<ImageViewer>(panViewer_SourceChanged);
   panViewer.InnerBrushChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_InnerBrushChanged);
   panViewer.OuterBrushChanged += new RoutedPropertyChangedEventHandler<Brush>(panViewer_OuterBrushChanged);
   panViewer.PositionChanged += new RoutedPropertyChangedEventHandler<Point>(panViewer_PositionChanged);
   ImageViewer viewerOld = panViewer.Source;
   // fires the SourceChanged event twice
   panViewer.Source = null;
   panViewer.Source = viewerOld;

   // change some properties
   panViewer.Stroke = new SolidColorBrush(Colors.Black);
   panViewer.StrokeThickness = 2;

   panViewer.Position = new Point(20, 20);
}

void panViewer_PositionChanged(object sender, RoutedPropertyChangedEventArgs<Point> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Position Changed to " + panViewer.Position.ToString());
}

void panViewer_OuterBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Inner Brush Changed to " + panViewer.OuterBrush.ToString() + "Color");
}

void panViewer_InnerBrushChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Inner Brush Changed to " + panViewer.InnerBrush.ToString() + "Color");
}

private void panViewer_StrokeChanged(object sender, RoutedPropertyChangedEventArgs<Brush> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
      Console.WriteLine("Rectangle Stroke Changed to " + panViewer.StrokeThickness.ToString() + "Thickness and to" + panViewer.Stroke.ToString() + "Color");
}

private void panViewer_SourceChanged(object sender, RoutedPropertyChangedEventArgs<ImageViewer> e)
{
   ImagePanViewer panViewer = (ImagePanViewer)sender;
   if (panViewer != null)
   {
      if (panViewer.Source == null)
         Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control");
      else
         Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control");
   }
}
Imports Leadtools.Windows.Controls

Public Sub ImagePanViewer_SourceChanged(ByVal panViewer As ImagePanViewer)
   ' set up the event handlers
   AddHandler panViewer.StrokeChanged, AddressOf panViewer_StrokeChanged
   AddHandler panViewer.SourceChanged, AddressOf panViewer_SourceChanged
   AddHandler panViewer.InnerBrushChanged, AddressOf panViewer_InnerBrushChanged
   AddHandler panViewer.OuterBrushChanged, AddressOf panViewer_OuterBrushChanged
   AddHandler panViewer.PositionChanged, AddressOf panViewer_PositionChanged
   Dim viewerOld As ImageViewer = panViewer.Source
   ' fires the SourceChanged event twice
   panViewer.Source = Nothing
   panViewer.Source = viewerOld

   ' change some properties
   panViewer.Stroke = New SolidColorBrush(Colors.Black)
   panViewer.StrokeThickness = 2

   panViewer.Position = New Point(20, 20)
End Sub

Private Sub panViewer_PositionChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Point))
   Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
   If Not panViewer Is Nothing Then
      Console.WriteLine("Position Changed to " & panViewer.Position.ToString())
   End If
End Sub

Private Sub panViewer_OuterBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
   Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
   If Not panViewer Is Nothing Then
      Console.WriteLine("Inner Brush Changed to " & panViewer.OuterBrush.ToString() & "Color")
   End If
End Sub

Private Sub panViewer_InnerBrushChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
   Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
   If Not panViewer Is Nothing Then
      Console.WriteLine("Inner Brush Changed to " & panViewer.InnerBrush.ToString() & "Color")
   End If
End Sub

Private Sub panViewer_StrokeChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Brush))
   Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
   If Not panViewer Is Nothing Then
      Console.WriteLine("Rectangle Stroke Changed to " & panViewer.StrokeThickness.ToString() & "Thickness and to" & panViewer.Stroke.ToString() & "Color")
   End If
End Sub

Private Sub panViewer_SourceChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of ImageViewer))
   Dim panViewer As ImagePanViewer = CType(sender, ImagePanViewer)
   If Not panViewer Is Nothing Then
      If panViewer.Source Is Nothing Then
         Console.WriteLine("There is no Viewer control associated with the ImagePanViewer Control")
      Else
         Console.WriteLine("A Viewer is now associated with the ImagePanViewer Control")
      End If
   End If
End Sub
Requirements

Target Platforms

See Also

Reference

ImagePanViewer Class
ImagePanViewer Members

Error processing SSI file