Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: ExtendedDataGrid SortDescription exception [21880]

$
0
0
I am using ExtendedDataGrid to display data. I need to display the data sort by Name by default.
I am using ICollectionView for data binding. I am adding SortDescription to sort based on the Employee Name by default.

I am getting following exception while loading the view.

System.Windows.Markup.XamlParseException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
```
<wpfExtDataGrid:ExtendedDataGrid x:Name="ExtendedGrid" ItemSoource = "{Binding CollectionViewList}" >
<wpfExtDataGrid:ExtendedDataGrid.Columns>

<Custom:DataGridTextColumn x:Name="EmpId"
Header="EmpId"
Width="2*"
Binding="{Binding EmpId}"
IsReadOnly="True"/>

<Custom:DataGridTextColumn x:Name="Name"
Header="Name"
Width="*"
Binding="{Binding Name}"
IsReadOnly="True" />

</wpfExtDataGrid:ExtendedDataGrid.Columns>
</wpfExtDataGrid:ExtendedDataGrid>

```
Public class EmployeeViewModel
{
public EmployeeViewModel ()
{
EmployeeDetails = new List<Employee>();

for (int i = 10; i > 0; i--)
{
EmployeeDetails.Add(new Employee
{
EmpId = i,
Name = i + "Name"
});
}

CollectionViewList = CollectionViewSource.GetDefaultView(EmployeeDetails);
CollectionViewList.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
}

public ICollectionView CollectionViewList { get; set; }

private ObservableCollection<Employee> _employeeDetails;

public ObservableCollection<Employee> EmployeeDetails
{
get { return _employeeDetails; }
set { _employeeDetails = value; }
}
}

Regards,
Sharda
Comments: ** Comment from web user: BoucherS **

Hi,

The ExtendedDatagrid is not part of the Xceed,Wpf.Toolkit. The Xceed.Wpf.Toolkit only includes one grid : the DataGridControl. This site should only be used for the controls that exists in the Xceed.Wpf.Toolkit.


Viewing all articles
Browse latest Browse all 4964

Trending Articles