skliz4rel
skliz4rel

Reputation: 198

select box that would be populated through a web api

I am developing a windows mobile app. But I am currently stocked at one of my task. Which is to create a select box that would get populated with Continents round the world from my web api. My first problem is I have not seen the select box control in windows phone 8 toolkit. So I don't know how to create a select box. I also need help with populating the select box when the users lands on the page. Cos the user is expected to select his or her continent.

When I put this in my xaml I get an error saying toolkit prefix is undefined

  <toolkit:ListPicker 
                Grid.Column="0"
                Grid.Row="0"
                Grid.ColumnSpan="2"
                x:Name="KListPicker"
                Header="K"               
                ListPickerMode="Normal"
                >

                <toolkit:ListPickerItem Content="K 1" />
                <toolkit:ListPickerItem Content="K 2" />
                <toolkit:ListPickerItem Content="K 3" />
                <toolkit:ListPickerItem Content="K 4" />
                <toolkit:ListPickerItem Content="K 5" />
            </toolkit:ListPicker>

Upvotes: 0

Views: 72

Answers (3)

Mashhood Adeeb
Mashhood Adeeb

Reputation: 37

Try This

 <TextBlock
                x:Name="title"
                Text="School" 
                    Foreground="Black"
                    FontSize="32"
                    VerticalAlignment="Center"

                Margin="5,32,5,23" 
                Tap="title_Tap_1"
                Style="{StaticResource PhoneTextTitle1Style}" Height="52" >

              <toolkit:ContextMenuService.ContextMenu >
                                <toolkit:ContextMenu>
                                    <toolkit:MenuItem Header ="School" Click="MenuItem_School"/>
                                    <toolkit:MenuItem Header ="Class"  Click="MenuItem_Class"/>
                                    <toolkit:MenuItem Header ="Me"     Click="MenuItem_Me"/>
                                </toolkit:ContextMenu>
                            </toolkit:ContextMenuService.ContextMenu>
                    </TextBlock>

Upvotes: 0

A.K.
A.K.

Reputation: 3331

You are looking for a listpicker(acts like a combobox/selectbox).

Listpicker is actually the Windows Phone 7 equivalent of the ComboBox control. It shows the selected item from a list and also allows the user to pick from a list if they want to change it. ListPicker is a standard ItemsControl subclass with all the common elements of a Selector, set of properties for customization and item display, data binding support.

you just need to learn how to make a listpicker and how to bind data inside it

here is the best link to take a start with.

Adding a reference to microsoft.phone.controls.toolit dll

just look for the line shell:SystemTray.IsVisible="True" on your xaml and add a line above that

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

Upvotes: 1

Related Questions