2017-05-31 20 views
1

私はXamarin Formsでアプリケーションを作成しています。私はYouTubeに似てリストビューを表示するアプリをしたい。左側にサムネイルがあり、右側にビデオタイトルがあり、その下に詳細が表示されています。現在、私はただ一つの行にしか細部を置くことができません。イメージセル複数バインディング形式XAML

詳細はどのようにイメージセル内の複数の行に分けられますか?現在

enter image description here

Homepage.xaml:

<StackLayout Orientation="Vertical"> 
    <SearchBar x:Name="MainSearchBar" HorizontalOptions="Center" /> 
    <ListView x:Name="VideoList" HasUnevenRows="True"> 
     <ListView.ItemTemplate> 
      <DataTemplate> 

       <ImageCell Text = "{Binding Title}" Detail="{Binding Detail}" ImageSource="{Binding ImageURL}"/> 

      </DataTemplate> 
     </ListView.ItemTemplate> 
    </ListView> 
</StackLayout> 

Videos.cs:

class Videos 
{ 
    public string Title { get; set; } 

    public string Author { get; set; } 
    public int Views { get; set; } 
    public DateTime Upload_DateTime { get; set; } 
    public string ImageURL { get; set; } 

    public string Detail 
    { 

     get 
     { 
      return string.Format("{0} - {1} Views Uploaded: {2} ", Author, Views, Upload_DateTime); //format for details on imagecell 
     } 
    } 


} 

注:私はVideos.csに次の形式を試してみました:

return string.Format("{0} - {1} Views \nUploaded: {2} ", Author, Views, Upload_DateTime);

return string.Format("{0} - {1} Views&#x0a;Uploaded: {2} ", Author, Views, Upload_DateTime);

+2

あなたは答えとしてViewCellを使用し、代わりに、事前に定義されたImageCell – Jason

答えて

0

おかげ@Jason!

私はビューセルの内部にグリッドレイアウトを持っています。それはまさに私が必要としているようです!次に、私はそれをよりきれいに見せるために書式を修正する必要がありますが、ほとんどの場合、この質問に答えます!

enter image description here

Homepage.xaml:

<StackLayout Orientation="Vertical"> 
    <SearchBar x:Name="MainSearchBar" HorizontalOptions="Center" /> 
    <ListView x:Name="VideoList" HasUnevenRows="True"> 
     <ListView.ItemTemplate> 
      <DataTemplate> 

       <ViewCell> 
        <ViewCell.View> 
         <Grid> 
          <Grid.RowDefinitions> 
           <RowDefinition/> 
           <RowDefinition/> 
           <RowDefinition/> 
          </Grid.RowDefinitions> 

          <Grid.ColumnDefinitions> 
           <ColumnDefinition/> 
           <ColumnDefinition/> 
          </Grid.ColumnDefinitions> 

          <Image Source="{Binding ImageURL}" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3"/> 
          <Label Text="{Binding Title}" Grid.Row="0" Grid.Column="1"/> 
          <Label Text="{Binding Author_Views}" Grid.Row="1" Grid.Column="1"/> 
          <Label Text="{Binding Uploaded}" Grid.Row="2" Grid.Column="1"/> 
         </Grid> 
        </ViewCell.View> 
       </ViewCell> 
      </DataTemplate> 
     </ListView.ItemTemplate> 
    </ListView> 
</StackLayout> 
+1

OK、フラグに質問を使用しての独自のレイアウトを定義する必要があります –

関連する問題