This is a migrated thread and some comments may be shown as answers.

Binding MVVM with (only) some columns autogenerated from a collection

0 Answers 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Philippe
Top achievements
Rank 1
Philippe asked on 20 Apr 2011, 03:50 PM
Hi,

I have a collection of objects which I want to bind to a RadGridView. The class of the objects is looking like that (minimum code needed to understand) where I have 1 property and 1 array of values which :

public class AttributeEntry : INotifyPropertyChanged
    {
        public string Code { get; set; }
        private string[] _values;
        public string[] Values
        {
            get { return _values; }
            set { _values = value; }
        }
        public string this[int index]
        {
            get { return _values[index]; }
            set
            {
                _values[index] = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs(Binding.IndexerName));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }

Is someone know a (simple) way, using the patern MVVM,  to have a RadGridView with some columns defined (in my case corresponding to the 'Code' property) and some columns "autogenerated" with each columns corresponding to the elements of a collection (in my case the elements of the array 'Values". If I have 7 values in my collection, I should have 7 "autogenerated" columns).

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Philippe
Top achievements
Rank 1
Share this question
or