<listView:SfListView
x:Name="productsList"
ItemsSource="{Binding saleNoteItems}"
IsVisible="{Binding cartListVisible}"
IsScrollingEnabled="false"
ItemSpacing="10,5"
VerticalOptions="CenterAndExpand"
SelectionMode="Single"
SelectionBackgroundColor="Transparent"
BackgroundColor="{StaticResource Gray-100}"
AutoFitMode="DynamicHeight">
<listView:SfListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Grid.Column="0" Margin="0">
<Grid
ColumnSpacing="0"
Grid.ColumnDefinitions="0.60*,0.1*, 0.15*, 0.15*"
Grid.RowDefinitions="auto, auto"
RowSpacing="0"
Padding="10">
<Label
Grid.Row="0"
Grid.Column="0"
FontFamily="Montserrat-Medium"
FontSize="12"
Text="{Binding Description}"
TextColor="{DynamicResource Gray-800}"
LineBreakMode="WordWrap"
VerticalOptions="CenterAndExpand"
HorizontalOptions="StartAndExpand"/>
<Label
Grid.Row="1"
Grid.Column="0"
FontFamily="Montserrat-Medium"
FontSize="10"
Text="{Binding Total, StringFormat='{0:C}'}"
TextColor="{DynamicResource Gray-800}"
VerticalOptions="EndAndExpand"
HorizontalOptions="StartAndExpand"/>
<Label
Grid.Row="0" Grid.RowSpan="2"
Grid.Column="1"
FontFamily="Montserrat-Medium"
FontSize="Small"
Text="{Binding Quantity}"
TextColor="{DynamicResource Gray-800}"
VerticalOptions="CenterAndExpand"/>
<buttons:SfButton
Grid.Row="0" Grid.RowSpan="2"
Grid.Column="2"
IsEnabled="{Binding IsButtonEnabled}"
IsVisible="{Binding IsProduct}"
Command="{Binding Path=BindingContext.PlusItemCommand, Source={x:Reference productsList}}"
CommandParameter="{Binding .}"
ShowIcon="True"
ImageSource="{StaticResource Icon_Plus_Circle}"
ImageWidth="45"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand">
</buttons:SfButton>
<buttons:SfButton
Grid.Row="0" Grid.RowSpan="2"
Grid.Column="3"
IsEnabled="{Binding IsButtonEnabled}"
Command="{Binding Path=BindingContext.MinusKitCommand, Source={x:Reference productsList}}"
CommandParameter="{Binding .}"
ShowIcon="True"
ImageSource="{StaticResource Icon_Minus_Circle}"
ImageWidth="45"
BackgroundColor="Transparent"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand">
</buttons:SfButton>
</Grid>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</listView:SfListView.ItemTemplate>
</listView:SfListView>
Hi Nelson,
We have modified the code snippets given to achieve your requirement using Grid. Please refer to the following code snippets and output for more reference,
|
<listView:SfListView x:Name="productsList" ItemsSource="{Binding ContactsInfo}" IsScrollingEnabled="False" ItemSpacing="10,5" VerticalOptions="CenterAndExpand" SelectionMode="Single" SelectionBackgroundColor="Transparent" AutoFitMode="DynamicHeight"> <listView:SfListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <Frame BorderColor="LightGray" Padding="10" CornerRadius="10"> <Grid ColumnSpacing="0" ColumnDefinitions="0.60*,0.10*, 0.30*" RowSpacing="0"> <Grid RowDefinitions="Auto, Auto"> <Label Grid.Row="0" Grid.Column="0" FontSize="12" Text="{Binding Description}" LineBreakMode="WordWrap" VerticalOptions="CenterAndExpand" HorizontalOptions="StartAndExpand"/> <Label Grid.Row="1" Grid.Column="0" FontSize="10" Text="{Binding Total, StringFormat='{0:C}'}" VerticalOptions="EndAndExpand" HorizontalOptions="StartAndExpand"/> </Grid> <Label Grid.Row="0" Grid.Column="1" FontSize="Small" Text="{Binding Quantity}" VerticalOptions="CenterAndExpand"/> <Grid Grid.Column="2"> <buttons:SfButton ShowIcon="True" ImageSource="plus" ImageWidth="45" BackgroundColor="Transparent" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"> </buttons:SfButton> <buttons:SfButton ShowIcon="True" Grid.Column="1" ImageSource="minus" ImageWidth="45" BackgroundColor="Transparent" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"> </buttons:SfButton> </Grid> </Grid> </Frame> </ViewCell.View> </ViewCell> </DataTemplate> </listView:SfListView.ItemTemplate> </listView:SfListView> |
Output
Please let us know if you need further assistance.
Regards,
Lakshmi Natarajan
Thanks for your reply. Its works perfectly
Regards
Hi Nelson,
If you are satisfied with our response, please mark it as an answer. Otherwise, please let us know if you have any further queries on this. We are happy to help you.
Lakshmi Natarajan