私はXamarin Formsが新しく、多くの便利なコントロールがあることを理解しています。私は、以下の例のようにグリッド内にデータを表示するために展開できるコントロールを探しています。XamarinフォームでListViewを展開および折りたたむ方法
更新
モデル:
public class Phone
{
public string mobile { get; set; }
public string home { get; set; }
public string office { get; set; }
}
public class Contact
{
public string id { get; set; }
public string name { get; set; }
public string email { get; set; }
public string address { get; set; }
public string gender { get; set; }
public Phone phone { get; set; }
}
public class ContactList
{
public List<Contact> contacts { get; set; }
}
XAML:
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Margin="10" Text="Display Json Data" FontSize="25" />
<ListView x:Name="listviewConacts" Grid.Row="1" HorizontalOptions="FillAndExpand" HasUnevenRows="True" ItemSelected="listviewContacts_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid HorizontalOptions="FillAndExpand" Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Text="{Binding name}" HorizontalOptions="StartAndExpand" Grid.Row="0" TextColor="Blue" FontAttributes="Bold"/>
<Label Text="{Binding email}" HorizontalOptions="StartAndExpand" Grid.Row="1" TextColor="Orange" FontAttributes="Bold"/>
<Label Text="{Binding phone.mobile}" HorizontalOptions="StartAndExpand" Grid.Row="2" TextColor="Gray" FontAttributes="Bold"/>
<BoxView HeightRequest="2" Margin="0,10,10,0" BackgroundColor="Gray" Grid.Row="3" HorizontalOptions="FillAndExpand" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<ActivityIndicator x:Name="ProgressLoader" IsRunning="True"/>
</Grid>
モデルと上記のXAMLに基づいて、どのように私は、展開や縮小が可能なを達成することができます012上記の画像のような?
それはデフォルトではありませんが、あなたはアコーディオンコントロール –
を探しているようにそれが見えるものからコントロールがありますNugetではAndroidのExpandableListView(Mono.Droidではなく)に相当します。アコーデオンコントロールの名前は何ですか、それをNugetから得ることができますか? – MilkBottle
https://www.nuget.org/packages/Xamarin.CustomControls.AccordionView/またはhttps://forums.xamarin.com/discussion/33975/how-to-implement-expandable-collapsible-listview-in-xamarin-フォームまたはhttps://www.codeproject.com/Articles/1088093/Simple-Accordion-User-Control-in-Xamarin-Forms –