Issue with List picker FullModeItemTemplate template

815 views Asked by At

I am using the Listpicker control in my WP8 app, where FullModeItemTemplate is defined to display a custom list of options and I enabled SelectionMode to Multiple, so that user can select multiple options from the Listpicker. On code behind, i am binding the text.

My main question, with below my xaml output of the fullmode has lot of free space between each list item. I couldn't able to figure out how to minimize the gap between...

<toolkit:ListPicker x:Name="userCountryList" ItemsSource="{Binding CountryList}"  Header="Choose a country or region:"  SelectionMode="Multiple" FullModeItemTemplate="{StaticResource DataTemplate2}" />

<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="DataTemplate2">
        <StackPanel Orientation="Horizontal">
           <TextBlock HorizontalAlignment="Left"  FontSize="28" TextWrapping="Wrap" Text="{Binding CountryName}" VerticalAlignment="Center" Width="Auto"/>
        </StackPanel>
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

Current fullmode output is like below: enter image description here

1

There are 1 answers

1
ChandrasekarG On

Replace

<TextBlock HorizontalAlignment="Left"  FontSize="28" TextWrapping="Wrap" Text="{Binding CountryName}" VerticalAlignment="Center" Width="Auto"/>

with

 <TextBlock HorizontalAlignment="Left"  FontSize="28"  Margin="10,5,0,20" TextWrapping="Wrap" Text="{Binding CountryName}" VerticalAlignment="Center" Width="Auto" />

That is we have just modified the margin field. further you can also edit these margin values Margin="Left, Top, Right, Bottom". Negative indentation is also allowed.

Hope this helps.Good Luck.