2017-03-07 47 views
1

這是我現在的代碼。有沒有辦法讓我的BackgroundImage均勻地填充ContentPage? Xamarin.Forms,XAML

<?xml version="1.0" encoding="utf-8"?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Quickies" x:Class="Quickies.QuickiesPage" BackgroundImage="Overview Image.png"> 
</ContentPage> 

是否有一個屬性,我可以在XAML中設置使圖像均勻地填充頁面?這是截止目前:

[1]

回答

4

嘗試這可能會幫助你。

<?xml version="1.0" encoding="utf-8"?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:Quickies" x:Class="Quickies.QuickiesPage"> 
<Grid Padding="0"> 
    <Image 
     Aspect="AspectFill" 
     Source="Overview Image.png" 
     RelativeLayout.WidthConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Width}" 
     RelativeLayout.HeightConstraint= "{ConstraintExpression Type=RelativeToParent, Property=Height}"> 
    </Image> 
</Grid> 
</ContentPage> 
+0

是的,我能夠用相同的代碼實現我想要的。我只想知道是否有辦法讓其他一些財產發生這種情況。我開始認爲沒有。 –

+0

@ msloan11我曾搜索過其他解決方案,但最終以此爲準。 –

相關問題