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

Grouping By FacetedObject

3 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jesse
Top achievements
Rank 1
Jesse asked on 11 Feb 2013, 10:27 PM
I am trying to use grouping on an ObservableCollection of FacetedObject. FacetedObject is a custom class built on the fly, and this is the error I get. 

No generic method 'OrderBy' on type 'System.Linq.Queryable' is compatible with supplied type.

For Reference this is the definition of FacetedObject. 
   public class FacetedObject : ICustomTypeProvider, INotifyPropertyChanged, INotifyDataErrorInfo
    {
        public FacetedObject()
        {
            Id = Guid.NewGuid();
            _facetValues = new Dictionary<string, object>();
            _errorManager = new ValidationErrorManager(this, s => OnErrorsChanged(s));
            _currentFacets = new List<Facet>();
            _currentFacets.Add(Facet.DynamicDemo0);
            _currentFacets.Add(Facet.DynamicDemo1);
        }

        List<Facet> _currentFacets;

        private Guid _Id;

        /// <summary>
        /// A property we can use to show that normal & dynamic properties can be mixed
        /// </summary>
        public Guid Id
        {
            get { return _Id; }
            set
            {
                _Id = value;
                OnPropertyChanged("Id");
            }
        }
        

        ValidationErrorManager _errorManager;

        Dictionary<string, object> _facetValues;

        public object this[string key]
        {
            get
            {
                if (!_facetValues.ContainsKey(key))
                {
                    return null;
                }
                return _facetValues[key];
            }
            set
            {
                _facetValues[key] = value;
                OnPropertyChanged(key);
            }
        }

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Feb 2013, 06:59 AM
Hello,

 This is already fixed in our latest official release - Q3 2012 SP1. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Austin
Top achievements
Rank 1
answered on 13 Feb 2013, 08:30 PM
Hey,

I was having the same issue. However, when I upgraded to the newest version, the custom columns (faceted types / faceted value pairs) stopped displaying data.

Based on the code above, it looks like Jesse and I were both referencing Damon Payne's article on faceted objects:

http://www.damonpayne.com/post/2011/04/14/Using-ICustomTypeProvider-in-Silverlight-5.aspx.

Essentially, I am binding RadGridView to a collection of ICustomTypeProvider objects by setting the ItemsSource in the code behind.

Attached is a screenshot of the result when I run the project.

Thanks for your help, please let me know what other information I need to provide.

Austin



0
Vlad
Telerik team
answered on 14 Feb 2013, 07:49 AM
Hello guys,

The issue is fixed in our latest internal build (you can get the build from your accounts). We are about to release also (next week) our official Q1 2013. If you want you can wait for the official release. 

I've attached also modified version of the application from the blog post for reference. I would like to point also that if you want to have null values (like the properties in this blog post) you should use nullable types. The correct implementation of Facet class should be:

    public class Facet
    {
        public Facet()
        {
        }

        /// <summary>
        /// Must be a valid CLR property name
        /// </summary>
        public string PropertyName { get; set; }

        public Type PropertyType { get; set; }

        public static Facet DynamicDemo0 = new Facet
        {
            PropertyName = "DynamicPropZero",
            PropertyType = typeof(string)
        };

        public static Facet DynamicDemo1 = new Facet
        {
            PropertyName = "DynamicPropOne",
            PropertyType = typeof(double?)
        };
    }

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Jesse
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Austin
Top achievements
Rank 1
Share this question
or