WPF VB.Net

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  x:Class="Microsoft.Samples.Graphics.UsingVisualBrush.MagnifyingGlassExample"
  Background="White">
  
    
      
    
          Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
      
        
          
            
              
                
              

            
                          Geometry="M 0,0 L 0,1 0.1,1 0.1,0.1 1,0.1 1,0 Z" />                      
          

        

      

       
    
  

    
    
              VerticalAlignment="Stretch"
        MouseMove="updateMagnifyingGlass" 
        Background="{StaticResource MyGridBackgroundBrushResource}">
        
        
        


this is a test 
        

        

      
    

    
      
        
          
            
              
                
                   
                    
                      
                    

                  
                   
                    
                                               Visual="{Binding ElementName=magnifiedPanel}"/>
                    

                    
                      
                    

                  

                

              

            

          

        

      
    
  


//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports System.Windows.Media
Imports System.Windows.Input
Namespace Microsoft.Samples.Graphics.UsingVisualBrush
  Public Partial Class MagnifyingGlassExample
    Inherits Page
    Private Shared ReadOnly distanceFromMouse As Double = 5
    Public Sub New()
    End Sub
    Private Sub updateMagnifyingGlass(sender As Object, args As MouseEventArgs)
      Mouse.SetCursor(Cursors.Cross)
      Dim currentMousePosition As Point = args.GetPosition(Me)
      If Me.ActualWidth - currentMousePosition.X > magnifyingGlassEllipse.Width + distanceFromMouse Then
        Canvas.SetLeft(magnifyingGlassEllipse, currentMousePosition.X + distanceFromMouse)
      Else
        Canvas.SetLeft(magnifyingGlassEllipse, currentMousePosition.X - distanceFromMouse - magnifyingGlassEllipse.Width)
      End If
      If Me.ActualHeight - currentMousePosition.Y > magnifyingGlassEllipse.Height + distanceFromMouse Then
        Canvas.SetTop(magnifyingGlassEllipse, currentMousePosition.Y + distanceFromMouse)
      Else
        Canvas.SetTop(magnifyingGlassEllipse, currentMousePosition.Y - distanceFromMouse - magnifyingGlassEllipse.Height)
      End If
      myVisualBrush.Viewbox = New Rect(currentMousePosition.X - 10, currentMousePosition.Y - 10, 20, 20)
    End Sub
  End Class
End Namespace