Mega Code Archive

 
Categories / C# / WPF
 

Using Viewbox and Viewport

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       HorizontalAlignment="Stretch" VerticalAlignment="Stretch">     <Rectangle>       <Rectangle.Fill>         <ImageBrush ViewboxUnits="Absolute" Viewbox="300,285,300,243"                      Viewport="0.1,0.321,0.7, 0.557"                      ImageSource="c:\image.jpg" />       </Rectangle.Fill>     </Rectangle> </Page>