2017-09-26 20 views
0

現在、UWPのレイアウトで子ビューを表示できませんが、アンドロイドで動作します。 (同じコードは画像ソースを変更するだけです)どんな種類の魂でもこれを手助けできますか?UWP Xamarinフォームでビューを表示できません

以下のコードは、2つの画像と2つのボタンを表示する必要があります。私は画像がうまく上がるかどうかをテストしているので、画像は互いに重なり合っています。アンドロイドでは、それは完璧にうまくいきますが、UWPではそうではありません。そして、私はPCLが一般的であると考えられていたので、どちらのプラットフォームでも動作するはずです。以下は

は私のコードです:

MainPage.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:UWPRaiseTest" 
      x:Class="UWPRaiseTest.MainPage"> 

    <ContentView> 
    <StackLayout Orientation="Vertical" BackgroundColor="Violet" x:Name="EntireLayout" IsEnabled="True"> 
     <RelativeLayout x:Name="ImageHolder" IsEnabled="True"> 
       <Image x:Name="Img1" Source="Assets/StoreLogo.png" BackgroundColor="AliceBlue" IsEnabled="True" 
         RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0,Constant=100}" 
         RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0, Constant=0}" /> 
       <Image x:Name="Img2" Source="Assets/StoreLogo.png" BackgroundColor="Red" IsEnabled="True" 
         RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0,Constant=120}" 
         RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0, Constant=0}" /> 
      </RelativeLayout> 
      <Button x:Name="RaiseObj1" BackgroundColor="Aquamarine" Text="Raise image 1 " Clicked="RaiseObj1_OnClicked" /> 

      <Button x:Name="RaiseObj2" BackgroundColor="Aquamarine" Text="Raise image 2" Clicked="RaiseObj2_OnClicked"/> 

     </StackLayout> 
</ContentView> 

</ContentPage> 

MainPage.xaml.cs

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Xamarin.Forms; 

namespace UWPRaiseTest 
{ 
    public partial class MainPage : ContentPage 
    { 
     public MainPage() 
     { 
      InitializeComponent(); 

     } 

     private void RaiseObj1_OnClicked(object sender, EventArgs e) 
     { 
      ImageHolder.RaiseChild(Img1); 
      ImageHolder.LowerChild(Img2); 

      EntireLayout.RaiseChild(Img1); 
     } 

     private void RaiseObj2_OnClicked(object sender, EventArgs e) 
     { 
      ImageHolder.RaiseChild(Img2); 
      EntireLayout.RaiseChild(Img2); 
      ImageHolder.LowerChild(Img1); 


     } 
    } 
} 

答えて

0

これは、プレリリースビルド2.4.0で修正されています。最初に提出されたバグhereを参照することができます。

関連する問題