2
Answers

Re:How to bind ListBox in silverlight3 with items from DB

vijay rags

vijay rags

13y
1.6k
1
Hi,
 
     How to bind the ListBox in silverlight3 with items from DB by calling a service which return values.

 <ListBox x:Name="ListBox2" Grid.Row="12" Grid.Column="1" Width="200" Height="200"  ScrollViewer.VerticalScrollBarVisibility="Visible"
                             SelectionMode="Extended" SelectionChanged="ListBox2_SelectionChanged" Margin="10" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{Binding Name}" Margin="5" Foreground="Black"></TextBlock>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

This is what i did and in the code behind called the Service and ListBox2.DataContext=Result of the Service.

Please help me out.

Thanks in advance.




Answers (2)