Link to home
Start Free TrialLog in
Avatar of Wizard_Microsystems
Wizard_Microsystems

asked on

WPF Binding to DataGrid (List is Complete; No data in DataGrid)

I am having trouble with what I believe is the binding to a datagrid.  When I step-through the code, I can see that as the while executes, each row is calculated correctly; that the data is there, but it just doesn't show-up in the datagrid.  I am getting a datagrid with a single empty column (when there should be three columns in this snippet example, with data filling a number of rows).

Does what I have shown provide enough information for someone to right my wrong?
Is there an issue with using the ItemsSource property of DataGrid?  As is seen below, AutoGenerateColumns is set to False.

* * * BEGIN C# SNIPPET * * *

private void RunApp()
{
     List<Result> RowResults = new List<Result>();
     int a = 0;
     int b = 0;
     int c = 0;
     . . .
     while (true)
     {
        . . .
        RowResults.Add(new Result() { A = a, B = b, C = c });
     }
dataGrid1.ItemsSource = RowResults;

* * * END C# SNIPPET * * *

Could there be something incorrect with my xaml; a property or reference perhaps?
Here is the DataGrid object:

<DataGrid Name="dataGrid1" AutoGenerateColumns="False"  Width="400" Height="300" HorizontalAlignment="Left" Margin="400,80,0,0" VerticalAlignment="Top" >

Thank you in advance!
ASKER CERTIFIED SOLUTION
Avatar of Wizard_Microsystems
Wizard_Microsystems

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial