locked
GridView Data Binding - programmatically with C# RRS feed

  • Question

  • I am writing to ask how best to data bind a GridView - programmatically with C#;

    The code is calling out to a WCF Service application, and brings back results in a list;

    The below code displays an error of "cannot convert type string to DataGridColumn"

    Any insight, guidance is appreciated;

    scData = new Service4Client();
    var newTestSC = await scData.GetVWScorecardAsync(capFMFY, capGeoName, capSegment);
    
    scI = newTestSC.Count;
    
    for (int i = 0; i < scI; i++)
    {
       for (int j = 0; j < 5; j++)
       {
           this.rdgVWAccounts.Columns[j] = newTestSC[i].MetricDisplayName;
       }
    
    }


    robert hellestrae



    • Edited by rrobhelle Wednesday, June 26, 2013 9:47 PM typographical issue
    Wednesday, June 26, 2013 4:07 PM

Answers

  • Are you posting in the correct forum? Datagrid isn't a control available in Store apps, at least that I know of. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by rrobhelle Tuesday, July 2, 2013 6:14 PM
    Wednesday, June 26, 2013 9:35 PM
    Moderator
  • What is the structure of the returned list?  Is it a list of some custom object?  A list of strings?  Something else? 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by rrobhelle Tuesday, July 2, 2013 6:13 PM
    Wednesday, June 26, 2013 10:04 PM
    Moderator

All replies

  • Are you posting in the correct forum? Datagrid isn't a control available in Store apps, at least that I know of. 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by rrobhelle Tuesday, July 2, 2013 6:14 PM
    Wednesday, June 26, 2013 9:35 PM
    Moderator
  • Thanks Matt;

    I meant to indicate the GridView in Windows 8, for data binding via C#;

    The goal is to loop thru a result set from a WCF Service call with C#, interrogate a value within the result set - and assign the value to a corresponding position in the GridView;  

    Regards - Rob


    robert hellestrae


    • Edited by rrobhelle Wednesday, June 26, 2013 9:48 PM clarification
    Wednesday, June 26, 2013 9:44 PM
  • What is the structure of the returned list?  Is it a list of some custom object?  A list of strings?  Something else? 

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by rrobhelle Tuesday, July 2, 2013 6:13 PM
    Wednesday, June 26, 2013 10:04 PM
    Moderator
  • Observable Collection, which contains strings;


    robert hellestrae


    • Edited by rrobhelle Thursday, June 27, 2013 3:08 PM clarification
    Wednesday, June 26, 2013 10:21 PM