Grouping By FacetedObject

4 posts, 0 answers
  1. Jesse
    Jesse avatar
    1 posts
    Member since:
    Dec 2012

    Posted 11 Feb 2013 Link to this post

    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);
                }
            }
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Feb 2013 Link to this post

    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.

  3. Austin
    Austin avatar
    1 posts
    Member since:
    Sep 2011

    Posted 13 Feb 2013 Link to this post

    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



  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 14 Feb 2013 Link to this post

    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.

Back to Top