2016-07-08 7 views
1

こんにちは私はxamrian形式でやっているアプリがあり、カードスタイルのリストビューがあります。私は、リストビューの中心で左1の1及び右側 の1の下に3つのボタンを追加できるようにしたいここに私のXAMLです:Xamarin.Formsリストビューの下にボタンを追加する方法

<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
      x:Class="App.HomePage"> 
    <ListView x:Name="listView" HasUnevenRows="true" ItemSelected="OnItemSelected"> 
    <ListView.ItemTemplate> 
     <DataTemplate> 
     <ViewCell> 
      <Frame Padding="0,0,0,8" BackgroundColor="#d2d5d7"> 
      <Frame.Content> 
       <Frame Padding="15,15,15,15" OutlineColor="Gray" BackgroundColor="White"> 
       <Frame.Content> 
        <StackLayout Padding="20,0,0,0" Orientation="Horizontal" HorizontalOptions="CenterAndExpand"> 
        <Image 
          HorizontalOptions="StartAndExpand" 
          Source="{Binding Image}" /> 
        <Label Text="{Binding Name}" 
          TextColor="#69add1" 
          FontFamily="OpenSans-Light" 
          FontSize="24"/> 
        </StackLayout> 
       </Frame.Content> 
       </Frame> 
      </Frame.Content> 
      </Frame> 

      </ViewCell> 
     </DataTemplate> 
    </ListView.ItemTemplate> 
    </ListView> 
    </ContentPage> 

は、どのように私は、XAMLでこれをやって行くのでしょうか?

ありがとうございます! :)

答えて

1
<StackLayout> 
    <ListView> 
    ... 
    </ListView> 
    <StackLayout Orientation="Horizontal"> 
    <Button ... /> 
    <Button ... /> 
    <Button ... /> 
    </StackLayout> 
</StackLayout> 
+0

お返事ありがとうございました!私はあなたの提案を試みたが、何も他の提案をlistviewの下に表示されません? – Phoneswapshop

2

このお試しください:これはあなたのボタンが占有しないスペースを埋めるためにあなたのListViewを制限します

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

    <Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*"/> 
     <RowDefinition Height="Auto"/> 
    </Grid.RowDefinitions> 

    <ListView Grid.Row="0" BackgroundColor="Aqua"> 
     <!-- Add bindings and data template --> 
    </ListView> 
    <StackLayout Orientation="Horizontal" Grid.Row="1"> 
     <Button Text="Button1" HorizontalOptions="FillAndExpand"/> 
     <Button Text="Button2" HorizontalOptions="FillAndExpand"/> 
     <Button Text="Button3" HorizontalOptions="FillAndExpand"/> 
    </StackLayout> 
    </Grid> 

</ContentPage> 

を。出力は次のようになります。 UWP Desktop sample

+0

私はあなたの提案を試みましたが、アプリに他の提案は何も表示されませんでした。これまでのすべての助けてくれてありがとう! – Phoneswapshop

+0

好奇心 - 私のためにうまく動作します。私はより具体的に答えを更新しました - 水槽のバックグラウンドは伝えておくべきですが、バインディングエラーなどの出力ウィンドウに目を留めて、あなたに見えるものを教えてください。少なくともリストビューに問題があってもボタンを見ることができるはずです。スニペットをダブルチェックすると、リストビューをビュー外のオブジェクトにバインドしますか?そうでない場合、コンテンツをどのように受け取るかは不明です。 – Joe

+0

あなたは何のように見えますか?私はgridviewに何かをバインドしていないよ、それは問題だろうか? – Phoneswapshop

関連する問題