2015-01-03 65 views
1

我嘗試實現MapScrollBar到Avalonedit WPF控件。爲此,我需要Stetch VisualBrush垂直只。這意味着它總是應該調整垂直大小,以適應Container。它應該是均勻拉伸!但是,當我STE的StretchMode到UniFormToFill。它橫跨垂直或水平,直到它適應的。有沒有辦法讓我的期望行爲?WPF - >拉伸圖像垂直

回答

0

我現在已經修好了這樣:

    <Border Grid.Row="1"> 
         <Border.Background> 
          <VisualBrush RenderOptions.BitmapScalingMode="Linear" Stretch="Fill" AutoLayoutContent="True"> 
           <VisualBrush.Visual> 
            <ScrollViewer Width="800" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Visible"> 
             <rendering:TextView 
               MinHeight="{TemplateBinding ActualHeight}" 
               Document="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=2, AncestorType={x:Type ScrollViewer}}, Path=Content.Document}" /> 
            </ScrollViewer> 
           </VisualBrush.Visual> 
          </VisualBrush> 
         </Border.Background> 
        </Border> 

通過把它在一個ScrollViewer中與有固定的寬度和高度可變!