I have a form with a RadDataGrid on it.
I am trying to bind it's itemssource with the following code:
var products = JsonSerializer.Deserialize<List<Product>>(response);
dataGrid.ItemsSource = products;
No data is showing up in the grid.
If I set the value in the Constructor of the form (like in the demo code provided it binds fine.)
private void OnCounterClicked(object sender, EventArgs e)
{
try
{
var criteria = txtSearchBox.Text;
var response = client.DownloadString($@"http://rebelscum/apiswise/product/search?searchCriteria={criteria}");
var products = JsonSerializer.Deserialize<List<Product>>(response);
dataGrid.ItemsSource = products;
}
catch (Exception ex)
{
var x = 1;
}
<telerikDataGrid:RadDataGrid x:Name="dataGrid" Grid.Row="3" AutoGenerateColumns="False" >
<telerikDataGrid:RadDataGrid.Columns>
<telerikDataGrid:DataGridTextColumn PropertyName="id"
HeaderText="Id">
<telerikDataGrid:DataGridTextColumn.CellContentStyle>
<telerikDataGrid:DataGridTextCellStyle TextColor="Green"
FontSize="15"
SelectedTextColor="Orange" />
</telerikDataGrid:DataGridTextColumn.CellContentStyle>
</telerikDataGrid:DataGridTextColumn>
<telerikDataGrid:DataGridTextColumn PropertyName="description1"
HeaderText="Description">
<telerikDataGrid:DataGridTextColumn.CellContentStyle>
<telerikDataGrid:DataGridTextCellStyle TextColor="Green"
FontSize="15"
SelectedTextColor="Orange" />
</telerikDataGrid:DataGridTextColumn.CellContentStyle>
</telerikDataGrid:DataGridTextColumn>
</telerikDataGrid:RadDataGrid.Columns>
</telerikDataGrid:RadDataGrid>