I am creating a mobile app that needs to be connected with mysql. I used php to query it and got the data to my php page.. I would like to bind this data with the list box in my windows phone 7. I am very new to this kind of programming and would like to how to get the data from the php page and bind it with the list box in my wp7 app.. I managed to print the data using webclient in a messagebox in wp7 app.. but i would like to bind it to the list box… please help….
My code:
public Article()
{
InitializeComponent();
WebClient wc = new WebClient();
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(printlist);
wc.DownloadStringAsync(new Uri("http://www.skbcreations.com/app/Pushnotification.php") );
return;
}
void printlist(object sender, DownloadStringCompletedEventArgs e)
{
string res = (String)e.Result;
MessageBox.Show(res);
}
My XAML:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.061*"/>
<ColumnDefinition Width="0.939*"/>
</Grid.ColumnDefinitions>
<ListBox Grid.Column="1" Margin="24,28,36,56"/>
</Grid>
Which format has your response?
If XML, you could use this one:
Also, consider to use ObservableCollection if your list will be changing in run-time