Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6223171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:26:31+00:00 2026-05-24T08:26:31+00:00

I’m querying an online service (google data feed) which can return results that will

  • 0

I’m querying an online service (google data feed) which can return results that will have different numbers of columns and rows with each request.

So far I have been unable to get the data grid or grid to work for me. Ideally I want something that works like excel – you can just add rows and set the values for an individual cell

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:26:32+00:00Added an answer on May 24, 2026 at 8:26 am

    You can create a class e.g. myGridCol that represents the column and create a collection of the columns. Read the google data feed and create the columns. Then you need to add the columns individually e.g. myGridCol[0], myGridCol[1] .. as DataGridColumns in the code behind. You cannot bind directly to a column collection.

    You simply bind to a collection for the rows that has a collection for the columns.
    In my case I am using a GridView but I have used the same approach with DataGrid
    In my case sDocs is an ObservableCollection
    sDoc has public List DocFields
    The Fields collection is exactly the same in each sDoc because I made sure it was.
    If the Fields collection is not the same in each sDoc then it does not like that.
    sDocs is the ItemsSource for the GridView
    Then in the code behind I add the columns. As I said before you cannot bind directly to a columns collection. Notice you can even bind the Path to a Property (.e.g. DispValueShort). My class for DocField has other Properties and methods. DocField is actually an Abstract Class with and Abstract Property DispValueShort. Then I have classes for string, date, and enumeration that implement DocField because edit of a string is different from edit of a date. I even have classes for single value and multi value. This is a stable production application.

    Binding

        <ListView Grid.Row="1" Grid.Column="0" x:Name="lvSrchResulsGrid" 
                ItemsSource="{Binding Path=MyGabeLib.Search.SDocs}"
    

    Code behind

        sDocBaseResultDocsFieldsIndex = 0;      
        foreach (GabeLib.DocField docField in sDocBaseResultDocsFields)
        {
            // Debug.WriteLine("  sDocBaseResultDocsFields DispName = " + docField.FieldDef.DispName);
            if (fd.FieldDef == docField.FieldDefApplied.FieldDef)
            {
                 gvc = new GridViewColumn();                 
                 gvch = new GridViewColumnHeader();
                 gvch.Content = fd.FieldDef.DispName;
                 gvch.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
                 if (fd.FieldDef.Sort)
                 {
                     gvch.Click += new RoutedEventHandler(SortClick);
                     gvch.Tag = fd.FieldDef.Name;
                 }
    
                 if (!fd.AppliedDispGrid) gvc.Width = 0;  // how to hide
                 gvc.Header = gvch;
    
                 gvBinding = new Binding();
                 gvBinding.Mode = BindingMode.OneWay;
                 gvBinding.Path = new PropertyPath("DocFields[" + sDocBaseResultDocsFieldsIndex.ToString() + "].DispValueShort");
    
                 template = new DataTemplate();
                 textblock = new FrameworkElementFactory(typeof(TextBlock));
                 textblock.SetValue(TextBlock.TextProperty, gvBinding);
                 textblock.SetValue(TextBlock.TextTrimmingProperty, TextTrimming.WordEllipsis);
    
                 // <Setter Property="TextTrimming" Value="WordEllipsis" />
    
                 template.VisualTree = new FrameworkElementFactory(typeof(Grid));
                 template.VisualTree.AppendChild(textblock);
    
                 gvc.CellTemplate = template;
    
                 gvSearchResults.Columns.Add(gvc);
                 break;
             }
             sDocBaseResultDocsFieldsIndex++;
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.