Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
970
FieldLayouts issue example code in WPF 2011.1
posted

What's wrong here?  This will not show any values unless you uncomment the 2 lines, or uncomment the 2 lines and add more data too get 2 lines of data.

           ObservableCollection<string> FieldValue;
            ObservableCollection<ObservableCollection<string>> tableValues = new ObservableCollection<ObservableCollection<string>>();
            xamDataGrid1.FieldLayoutSettings.AutoGenerateFields = false;

            xamDataGrid1.FieldLayouts.Add(BuildHeader("FirstName", "LastName", "Age"));

            FieldValue = new ObservableCollection<string> { "John", "Doe", "19" };
            tableValues.Add(FieldValue);


            //FieldValue = new ObservableCollection<string>();
            //tableValues.Add(FieldValue);

        private FieldLayout BuildHeader(params string[] headers)
        {
            FieldLayout fldLayout = new FieldLayout();
            for (int i = 0; i < headers.Count(); i++)
            {
                string s = headers[i];
                UnboundField uf = new UnboundField();
                uf.Name = s;
                uf.Label = s;
                uf.BindingPath = new PropertyPath("Items[" + i.ToString() + "]", null);
                fldLayout.Fields.Add(uf);
            }
            return fldLayout;
        }

            xamDataGrid1.DataSource = tableValues;

 

 

 

Parents
No Data
Reply
  • 30945
    Offline posted

    Hello,

     

    I have been looking into your post and I am not completely sure what you are trying to achieve using the code snippet that you have posted. Would you please give me more detailed description of how the approach that you are implementing is supposed to behave and the appearance of the XamDataGrid that you are expecting to achieve using the code snippet that you have posted?

     

    Looking forward to hearing from you.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

Children