سلام بر برنامه نویسان عزیز 😉 در این مطلب کد استفاده از Viewbox و Viewport برای ImageBrush با wpf و c#.net را آماده کردم. انشاالله که این کد سی شارپ براتون مفید باشد.
کد استفاده از Viewbox و Viewport برای ImageBrush با wpf و c#.net :
<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" />
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" />