Question

I have the follwing listpicker

<toolkit:ListPicker  ItemsSource="{Binding title}" Name="titlePicker" ExpansionMode="ExpansionAllowed" Grid.Row="1" Margin="0,-50,50,0" Background="White" Foreground="#FFDA3434"  Canvas.ZIndex="10"  HorizontalAlignment="Right" FontSize="20" Grid.RowSpan="2"/>

that contains 3 items and i would like them to align right, but for some reason i can't find the option to align the text, what am i missing?

Was it helpful?

Solution

You should do this in the ListPickerItemTemplate. Add Template to the page resources (or app resources)

<phone:PhoneApplicationPage.Resources>
  <DataTemplate x:Name="ListPickerItemTemplate">
     <StackPanel Orientation="Horizontal">
        <TextBlock HorizontalAlignment="Right" Text="{Binding ItemName}"/>
       </StackPanel>
    </DataTemplate>
    <DataTemplate x:Name="ListPickerFullModeItemTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock HorizontalAlignment="Right" Text="{Binding ItemName}"/>
        </StackPanel>
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

and assign template to the picker:

<toolkit:ListPicker  
   ItemTemplate="{StaticResource ListPickerItemTemplate}" 
   FullModeItemTemplate="{StaticResource ListPickerFullModeItemTemplate}" 
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top