Forum General
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

ListView Item spacing issue with Switch/Toggle button

jainankit2474jainankit2474 INMember ✭✭
edited May 2018 in General

I am using a ListView and every row of the list contains a Label and a Switch, there is some margin around the Switch which wishes to remove.

Screenshot:

Xaml:

            <ListView ItemsSource="{Binding ListOfEnums}" Grid.Row="0" Grid.Column="1"
                  Grid.ColumnSpan="2"
                  VerticalOptions="FillAndExpand">
                <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid>
                        <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Label VerticalTextAlignment="Center"
                                    Text="{Binding Status, Converter={StaticResource EnumToStringConverter}}" />
                                    <Switch IsToggled="{Binding Selected}" Grid.Column="1" Margin="0,0,20,0" />
                    </Grid>
                </ViewCell>
            </DataTemplate>
            </ListView.ItemTemplate>
            </ListView>

What can I do to remove/reduce the spaces between the list rows?

Answers

Sign In or Register to comment.