2016-08-05 14 views
0

私は理解できない非常に奇妙な動作を見ます。私は2つのフレームを縦向きのStackLayoutの中に入れています。最初のフレームの垂直オプションは正しく表示されるStartAndExpandに設定されていますが、2番目のフレームのVerticalOptionはFillAndExpandに設定されています。私は最初のフレームの後すぐに2番目のフレームをフォローし、画面全体を取りたいと思っています。 コード:Xamarin Forms StackLayout 2つのフレームが画面いっぱいにない

<RelativeLayout 
     x:Name="mainLayout"   
     HorizontalOptions="FillAndExpand" 
     VerticalOptions="FillAndExpand" 
     RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}" 
     RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}">  
      <StackLayout 
        Padding="5,5,5,5" 
        BackgroundColor="Transparent" 
        HorizontalOptions="FillAndExpand" 
        Orientation="Vertical" 
        Spacing="0" 
        VerticalOptions="FillAndExpand" 
        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}" 
        RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.88}" > 
       <Frame 
        OutlineColor="Silver" 
        BackgroundColor="#FFFFFF" 
        VerticalOptions="StartAndExpand" 
        HasShadow="False" > 
        <StackLayout 
          BackgroundColor="Transparent"> 
         <RelativeLayout 
          RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" 
          HorizontalOptions="FillAndExpand"> 
          <Label 
           x:Name="To_Label" 
           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.2}" 
           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}" 
           FontSize="Micro" 
           TranslationY="7" 
           FontAttributes="Bold" 
           HorizontalOptions="FillAndExpand" 
           VerticalOptions="CenterAndExpand" 
           TextColor="#2A84D3" 
           Text="To:"> 

          </Label> 
          <Controls:DoneEntry x:Name="To_Entry" 
            Text="{Binding Model.To}" 
            RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.22}" 
            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.70}" 
            VerticalOptions="CenterAndExpand" 
            HorizontalOptions="FillAndExpand" > 
           <CorcavBehaviors:Interaction.Behaviors> 
            <CorcavBehaviors:BehaviorCollection> 
             <PounceBehaviors:EntryTextChanged Command="{Binding ReceipientTextChangeCommand}"/> 
            </CorcavBehaviors:BehaviorCollection> 
           </CorcavBehaviors:Interaction.Behaviors> 
          </Controls:DoneEntry> 
         </RelativeLayout>       
        </StackLayout> 
       </Frame> 
       <Frame 
        OutlineColor="Silver" 
        BackgroundColor="#FFFFFF" 
        VerticalOptions="FillAndExpand" 
        HasShadow="False" > 
        <StackLayout 
          HorizontalOptions="FillAndExpand" 
          VerticalOptions="FillAndExpand" 
          BackgroundColor="Transparent"> 
         <Editor 
           Text="{Binding EmailContent}" 
           FontSize="Micro" 
           HorizontalOptions="FillAndExpand" 
           VerticalOptions="FillAndExpand" 
           > 
          <CorcavBehaviors:Interaction.Behaviors> 
           <CorcavBehaviors:BehaviorCollection> 
            <PounceBehaviors:EditorTextChanged Command="{Binding MessageTextChangedCommand}"/> 
           </CorcavBehaviors:BehaviorCollection> 
          </CorcavBehaviors:Interaction.Behaviors> 
         </Editor> 
        </StackLayout> 
       </Frame> 

      </StackLayout> 


     <RelativeLayout 
       Padding="5,5,5,5" 
       RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=.12}" 
       RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" 
       RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.88}" 
       HorizontalOptions="CenterAndExpand" 
       VerticalOptions="CenterAndExpand"> 

      <BoxView Color="#3E95D1" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" HeightRequest="1" /> 

      <Controls:SwipeRightButton x:Name="SendEmail_Button" 
        BackgroundColor="#2A84D3" 
        OutlineColor="Silver" 
        HasShadow="False" 
        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}" 
        RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.90}" > 

       <StackLayout x:Name="ImageLabelContainer" 
         RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" 
         RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.90}" 
         Orientation="Horizontal" 
         HorizontalOptions="CenterAndExpand"> 

        <Image 
          x:Name="connect_icon" 
          Source="sendemailwhite" 
          Aspect="AspectFill" 
          BackgroundColor="Transparent" 
          VerticalOptions="Center" 
          HorizontalOptions="Center"> 
        </Image> 
        <Label 
          VerticalOptions="Center" 
          HorizontalOptions="Center" 
          FontSize="Micro" 
          TextColor="#FFFFFF" 
          Text="Swipe to Send" /> 
       </StackLayout> 
      </Controls:SwipeRightButton> 
     </RelativeLayout> 
    </RelativeLayout> 

答えて

0

問題が見つかりました。最初のフレームのVerticalOptionは、StartAndExpandの代わりにStartにする必要があります。

関連する問題