Hello I have built a WebService
that returns data from SQL:
public void ListadoWebService()
{
// InitializeComponent();
ServiceTours.ServiceToursClient cl = new ServiceTours.ServiceToursClient();
cl.ListadoCompleted += new EventHandler<ListadoCompletedEventArgs>(Listado2);
cl.ListadoAsync();
}
private void Listado2(object sender, ListadoCompletedEventArgs e)
{
listB.ItemsSource = e.Result;
}
Now I try to display data in columns
of grid
. I thought that it would work with binding
the data to particular column as textblock
but I can't display the data even though the data are returned in e.Result
.
I tried following:
<ListBox x:Name="listB">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding id}" Grid.Column="0" />
<TextBlock Text="{Binding name}" Grid.Column="1" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
But still I have blackscreen.
Will somebody help me solve this out please?