Viraj Shah
Viraj Shah

Reputation: 308

List Picker issue in windows phone

List<Items> list = new List<Items>();

        list = (from query in doc.Descendants("row")
                   select new Items
                   {
                       Id = Convert.ToInt64(query.Element("Id").Value),
                       Name = query.Element("Name").Value,
                       title = query.Element("title").Value
                   }).ToList();

        listPicker1.DataContext = list;    

Is it possible to show by default "Select" in windows phone list picker and whenever I select list picker item, the item should be display.

Here is the code I have so far:

<toolkit:ListPicker ItemsSource="{Binding}" x:Name="listPicker1" FullModeHeader="Employee" SelectionChanged="ListPicker1_SelectionChanged" BorderThickness="0" Margin="130,-45,144,160" SelectedItem="{Binding}" SelectionMode="Single" ExpansionMode="FullScreenOnly" Header="" CacheMode="BitmapCache" Height="55" Background="White">
    <toolkit:ListPicker.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" TextWrapping="Wrap" FontSize="22" Width="200" Height="50" VerticalAlignment="Center" TextAlignment="Center" HorizontalAlignment="Center" Foreground="Blue"/>
            </StackPanel>
        </DataTemplate>
    </toolkit:ListPicker.ItemTemplate>

    <toolkit:ListPicker.FullModeItemTemplate>

        <DataTemplate>



                <StackPanel Orientation="Vertical">
                    <TextBlock Text="{Binding Name}" Margin="10" FontSize="24" TextWrapping="Wrap" Foreground="Black" Width="440"/>
                    <TextBlock Text="{Binding title}" FontSize="20" TextWrapping="Wrap" Foreground="Black" Width="440"/>
                </StackPanel>

        </DataTemplate>

    </toolkit:ListPicker.FullModeItemTemplate>

</toolkit:ListPicker>

Upvotes: 1

Views: 262

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222522

To make this add a item named "select" and set it as default.

Upvotes: 1

Related Questions