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

SortDescriptor error in Expression Blend 3

3 Answers 166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gilad Globen
Top achievements
Rank 1
Gilad Globen asked on 18 Nov 2009, 08:08 AM
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
Code:
<Telerik:RadGridView.SortDescriptors>
      <Telerik_Windows_Data:SortDescriptor  Member="ID" SortDirection="Descending"/>          
</Telerik:RadGridView.SortDescriptors>

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.


3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 19 Nov 2009, 12:21 PM
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:RadGridView.SortDescriptors>
                <telerik:SortDescriptor Member="Property1"/>
            </telerik:RadGridView.SortDescriptors>
        </telerik:RadGridView>
    </Grid>

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,
Milan
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.
0
Nils
Top achievements
Rank 1
answered on 12 Feb 2010, 01:14 PM
Milan,
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:RadGridView.SortDescriptors> 
    <telerik:SortDescriptor Member="BarProp1"/> 
  </telerik:RadGridView.SortDescriptors> 
</telerik:RadGridView> 
 


Nils
0
Nils
Top achievements
Rank 1
answered on 18 Feb 2010, 08:16 AM
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 !

Nils
Tags
GridView
Asked by
Gilad Globen
Top achievements
Rank 1
Answers by
Milan
Telerik team
Nils
Top achievements
Rank 1
Share this question
or