Occurs when any visual transformation properties changes in the control.
Supported in Silverlight, Windows Phone 7
Syntax
Visual Basic (Declaration) | |
---|
Public Event TransformChanged As EventHandler |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As ImageViewer
Dim handler As EventHandler
AddHandler instance.TransformChanged, handler |
Example
Visual Basic | Copy Code |
---|
Private Sub viewer_TransformChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
Dim s As String = String.Format("TransformChanged Event: {0}", viewer.Transform.ToString())
MessageBox.Show(s)
End Sub
Public Sub ImageViewer_TransformChanged(ByVal viewer As ImageViewer)
AddHandler viewer.TransformChanged, AddressOf viewer_TransformChanged
Select Case viewer.SizeMode
Case SizeMode.Fit
viewer.SizeMode = SizeMode.FitAlways
Case SizeMode.FitAlways
viewer.SizeMode = SizeMode.FitWidth
Case SizeMode.FitWidth
viewer.SizeMode = SizeMode.Normal
Case SizeMode.Normal
viewer.SizeMode = SizeMode.Stretch
Case SizeMode.Stretch
viewer.SizeMode = SizeMode.Fit
End Select
RemoveHandler viewer.TransformChanged, AddressOf viewer_TransformChanged
End Sub |
C# | Copy Code |
---|
private void viewer_TransformChanged(object sender, EventArgs e)
{
ImageViewer viewer = sender as ImageViewer;
string s = string.Format("TransformChanged Event: {0}", viewer.Transform.ToString());
MessageBox.Show(s);
}
public void ImageViewer_TransformChanged(ImageViewer viewer)
{
viewer.TransformChanged += new EventHandler(viewer_TransformChanged);
switch (viewer.SizeMode)
{
case SizeMode.Fit:
viewer.SizeMode = SizeMode.FitAlways;
break;
case SizeMode.FitAlways:
viewer.SizeMode = SizeMode.FitWidth;
break;
case SizeMode.FitWidth:
viewer.SizeMode = SizeMode.Normal;
break;
case SizeMode.Normal:
viewer.SizeMode = SizeMode.Stretch;
break;
case SizeMode.Stretch:
viewer.SizeMode = SizeMode.Fit;
break;
}
viewer.TransformChanged -= new EventHandler(viewer_TransformChanged);
} |
SilverlightCSharp | Copy Code |
---|
private void viewer_TransformChanged(object sender, EventArgs e)
{
ImageViewer viewer = sender as ImageViewer;
string s = string.Format("TransformChanged Event: {0}", viewer.Transform.ToString());
MessageBox.Show(s);
}
public void ImageViewer_TransformChanged(ImageViewer viewer)
{
viewer.TransformChanged += new EventHandler(viewer_TransformChanged);
switch (viewer.SizeMode)
{
case SizeMode.Fit:
viewer.SizeMode = SizeMode.FitAlways;
break;
case SizeMode.FitAlways:
viewer.SizeMode = SizeMode.FitWidth;
break;
case SizeMode.FitWidth:
viewer.SizeMode = SizeMode.Normal;
break;
case SizeMode.Normal:
viewer.SizeMode = SizeMode.Stretch;
break;
case SizeMode.Stretch:
viewer.SizeMode = SizeMode.Fit;
break;
}
viewer.TransformChanged -= new EventHandler(viewer_TransformChanged);
} |
SilverlightVB | Copy Code |
---|
Private Sub viewer_TransformChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim viewer As ImageViewer = TryCast(sender, ImageViewer)
Dim s As String = String.Format("TransformChanged Event: {0}", viewer.Transform.ToString())
MessageBox.Show(s)
End Sub
Public Sub ImageViewer_TransformChanged(ByVal viewer As ImageViewer)
AddHandler viewer.TransformChanged, AddressOf viewer_TransformChanged
Select Case viewer.SizeMode
Case SizeMode.Fit
viewer.SizeMode = SizeMode.FitAlways
Case SizeMode.FitAlways
viewer.SizeMode = SizeMode.FitWidth
Case SizeMode.FitWidth
viewer.SizeMode = SizeMode.Normal
Case SizeMode.Normal
viewer.SizeMode = SizeMode.Stretch
Case SizeMode.Stretch
viewer.SizeMode = SizeMode.Fit
End Select
RemoveHandler viewer.TransformChanged, AddressOf viewer_TransformChanged
End Sub |
Remarks
Requirements
Target Platforms: Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also