2012-09-11 44 views
0

我使用SharpVector將icon.svg轉換爲icon.xaml。 這個程序產生像DrawingBrush:在畫布上顯示DrawingBrush並保持其比例

<DrawingBrush x:Key="Plus"> 
<DrawingBrush.Drawing> 
    <DrawingGroup xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
     <DrawingGroup x:Name="DrawingLayer"> 
     <DrawingGroup.ClipGeometry> 
      <RectangleGeometry Rect="0,0,88.582672,88.582672" /> 
     </DrawingGroup.ClipGeometry> 
     <GeometryDrawing x:Name="path3767" Brush="#FF4D4D4D"> 
      <GeometryDrawing.Geometry> 
      <PathGeometry FillRule="Nonzero" Figures="M36.512901,88.58266L36.512901,51.833165 8.88026306711254E-07,51.833165 8.88026306711254E-07,36.47519 36.512901,36.47519 36.512901,-1.76623310039759E-05 52.069777,-1.76623310039759E-05 52.069777,36.47519 88.582677,36.47519 88.582677,51.833165 52.069777,51.833165 52.069777,88.58266z" /> 
      </GeometryDrawing.Geometry> 
     </GeometryDrawing> 
     </DrawingGroup> 
    </DrawingGroup> 
</DrawingBrush.Drawing> 

我的所有圖標。但現在我想在Canvas.Background顯示我的DrawingBrush,它的確定與:

<Grid Background="{DynamicResource Plus}" Height="200" Width="200" Margin="5">

但我想保持畫面比例的股票在矩形幾何,例如這裏矩形= 「0,0,88.582672,88.582672」。

我該怎麼做?

蓋特

回答

0

嘗試DrawingBrush的Stretch屬性設置爲統一:

<DrawingBrush x:Key="Plus" Stretch="Uniform"> 
...