Don't show Data in DataGrid

Posted by mSafdel on Stack Overflow See other posts from Stack Overflow or by mSafdel
Published on 2010-05-25T20:55:14Z Indexed on 2010/05/26 6:11 UTC
Read the original article Hit count: 165

Hi in my app, I used WCF Services for load data from SQL DB then in Completed Event Handler of my ServiceClient write this code:

void svc_GetOrdersCompleted(object sender, GetOrdersCompletedEventArgs e)
{
    if (e.Error == null)
    {
         dgOrders.ItemsSource = e.Result;
         txtStatus.Text = "";
    }
    else
         txtStatus.Text = "Error occured while loading orders from database";
}

dgOrders is my DataGrid and And AutoGenerateColumns set to True. in line 5: eResult have a number of Order objects but after this code DataGrid can't show data. Why?

this ia my xaml for dgOrders:

    <data:DataGrid x:Name="dgOrders"
                   Grid.Row="0"
                   Grid.Column="1"
                   AutoGenerateColumns="True"
                   SelectionChanged="dgOrders_SelectionChanged" Foreground="Green">
    </data:DataGrid>

this is my Source code please guide me.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight