SortDescriptor error in Expression Blend 3

4 posts, 0 answers
  1. Gilad Globen
    Gilad Globen avatar
    1 posts
    Member since:
    Nov 2009

    Posted 18 Nov 2009 Link to this post

    I have a RadGridView bound to a generic ObservableCollection of a class I use in my application.
    The class has a public property called ID (int)

    I created a sort descriptor to make sure the data is sorted using the ID field
          <Telerik_Windows_Data:SortDescriptor  Member="ID" SortDirection="Descending"/>          

    While working at run-time the code generates an Expression Blend 3 error:
    "Invalid property or field - 'ID' for type Object"

    I'd appreciate any input on why.

  2. Milan
    Milan avatar
    1989 posts

    Posted 19 Nov 2009 Link to this post

    Hello Gilad Globen,

    We are aware of this issue and we will fix it as soon as possible. Most probably you are binding the grid using a DataContext similarly to this:

    <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}">
            <telerik:RadGridView Margin="76,20,84,92" ItemsSource="{Binding Collection}">
                    <telerik:SortDescriptor Member="Property1"/>

    If you modify the ItemsSource binding to bind directly to the collection the problem should be eliminated.

    ItemsSource="{Binding Collection, Source={StaticResource SampleDataSource}}"

    Hope this helps.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft R3 2016 release webinar banner
  4. Nils
    Nils avatar
    46 posts
    Member since:
    Jul 2009

    Posted 12 Feb 2010 Link to this post

    can you tell what is the status on this ?
    I have the same problem using VS2008, RadControls for wpf version 2009.3.1314.35
    and binding the ItemsSource using a navigatable property:

    <telerik:RadGridView ItemsSource="{Binding Path=Foo.Bar}"
        <telerik:SortDescriptor Member="BarProp1"/> 

  5. Nils
    Nils avatar
    46 posts
    Member since:
    Jul 2009

    Posted 18 Feb 2010 Link to this post

    Gilad and others who have this Problem:
    Seems there are currently 3 ways to get this resolved:
    1. The one Milan described above
    2. Setting the SordDescriptor from code, not in xaml (right after InitializeComponents())
    3. Setting the SortDescriptor in xaml without setting the Member-Property (my preferred way)

    In third case make sure the Objects in ItemsSource implement IComparable !

Back to Top