Hi ,
please help me to bind the itemsource the string type list. I Used directly but it take extra space. so please help me to bind string type of list with fit proper content.
Regards,
Yogita Magdum
|
public class ContactsViewModel : INotifyPropertyChanged
{
public List<string> ContactsInfo { get; set; }
public ContactsViewModel()
{
ContactsInfo = new List<string>();
GenerateInfo();
}
public void GenerateInfo()
{
ContactsInfo = CustomerNames.ToList();
}
string[] CustomerNames = new string[] {
"Kyle",
"Gina",
"Irene",
"Katie",
...
};
} |
|
<syncfusion:SfListView x:Name="listView" ItemsSource="{Binding ContactsInfo}">
<syncfusion:SfListView.ItemTemplate >
<DataTemplate>
<Grid x:Name="grid">
<Label LineBreakMode="NoWrap" TextColor="#474747" Text="{Binding .}"/>
</Grid>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView> |
|
xmlns:local="clr-namespace:ListViewXamarin"
xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
xmlns:ListCollection="clr-namespace:System.Collections.Generic;assembly=netstandard"
x:Class="ListViewXamarin.MainPage">
<ContentPage.Content>
<StackLayout>
<syncfusion:SfListView>
<syncfusion:SfListView.ItemsSource>
<ListCollection:List x:TypeArguments="x:String">
<x:String>Item 1</x:String>
<x:String>Item 2</x:String>
<x:String>Item 3</x:String>
<x:String>Item 4</x:String>
<x:String>Item 5</x:String>
<x:String>Item 6</x:String>
<x:String>Item 7</x:String>
<x:String>Item 8</x:String>
<x:String>Item 9</x:String>
<x:String>Item 10</x:String>
</ListCollection:List>
</syncfusion:SfListView.ItemsSource>
<syncfusion:SfListView.ItemTemplate >
<DataTemplate>
<Grid x:Name="grid">
<Label LineBreakMode="NoWrap" TextColor="#474747" Text="{Binding .}"/>
</Grid>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
</StackLayout>
</ContentPage.Content>
</ContentPage> |
|
API |
Description |
|
The SfListView allows customizing the size of items by setting the ItemSize property. This property can be customized at runtime.
| |
|
The SfListView allows dynamically adjusting size of items based on the content loaded in the SfListView.ItemTemplate by defining the SfListView.AutoFitMode property.
The control contains the following three types of AutoFitMode:
Height: AutoFit the items based on the content.
DynamicHeight: AutoFit the items based on the content if size of the content is changed at run time.
None: The SfListView items are layout by SfListView.ItemSize.
| |
|
The
SfListView allows customizing the size of the item on-demand by the QueryItemSize event using the item index. |