2017-07-04 32 views
0

這是可以創建的嗎?我需要在選項卡上方添加2個按鈕,如下所示:如何將按鈕添加到Tabs上方的TabbedPage

<?xml version="1.0" encoding="utf-8" ?> 
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"   
    xmlns:local ="clr-namespace:SembIWIS.View" 
     x:Class="myApp.MainPage"> 

    <local:ProductPage> 
    </local:ProductPage> 

    <local:ServicePage> 
    </local:ServicePage> 

</TabbedPage> 

How to add two buttons in the TabbedPage, so It will look like : 

|----------------------| 
| TabbedPage   | 
|----------------------| 
|      | 
| btn1  btn2 | 
|      | 
|----------------------| 
| Tab1 | tab2 | tab3 ..| 
|----------------------| 
|      | 
|      | 
|      | 
------------------------ 

回答

0

是的,可以這樣做。您可以使用簡單的Grid結構,也可以使用VerticalOptions = EndAndExpandStackLayouts結合使用。這是Grid版本:

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="Auto" /> 
    </Grid.RowDefinitions> 
    <Grid Grid.Row="0"> 
     // Normal content 
    </Grid> 
    <Grid Grid.Row="1"> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="*" /> 
      <ColumnDefinition Width="*" /> 
     </Grid.ColumnDefinitions> 
     <Button Grid.Column="0" Text="Button 1" /> 
     <Button Grid.Column="1" Text="Button 2" /> 
    </Grid> 
</Grid> 
+0

在哪裏放置網格標籤?在第一個Tab(ProductPage)之上? ProductPage是普通的XAML頁面。 – MilkBottle

+0

它應該進入每個需要此頁面的頁面。如果你想讓它成爲一個標籤頁的一部分,你需要查看一個自定義的渲染器來覆蓋默認的TabbedPage和你自己的實現。 –

+0

我需要標籤外的按鈕。怎麼做?使用什麼自定義渲染器。你能指導我嗎? – MilkBottle