Hi,
I'm having an issue with the SfDataGrid control but maybe there is another way to do this or to bind it.
I got a SfDataGrid which ItemsSource is an ICollectionView (implemtned as a ListCollectionView). The source collection for it is a ObservableCollection:
private ObservableCollection<Venta> ventas;
public ICollectionView Ventas { get; private set; }
The definition of the SfDataGrid in the XAML is like this:
<Syncfusion:SfDataGrid Name="VentasList" AutoGenerateColumns="False" AllowEditing="False" AllowDeleting="False" AllowSorting="False" AllowFiltering="False"
ItemsSource="{Binding Path=Ventas}" SelectedItem="{Binding Path=Venta}">
<Syncfusion:SfDataGrid.Columns>
<Syncfusion:GridTextColumn HeaderText="Envasador" MappingName="Lote.Envasador.RazonSocial" AllowSorting="True" AllowFiltering="True" Width="250"/>
<Syncfusion:GridTextColumn HeaderText="Lote" MappingName="Lote.NumeroLote" Width="100"/>
<Syncfusion:GridDateTimeColumn HeaderText="Fecha" MappingName="FechaVenta" Pattern="ShortDate" Width="100"/>
<Syncfusion:GridNumericColumn HeaderText="Kilos" MappingName="Kilos" NumberDecimalDigits="1" NumberGroupSizes="3" Width="100"/>
<Syncfusion:GridTextColumn HeaderText="Envase" MappingName="Envase" Width="150"/>
</Syncfusion:SfDataGrid.Columns>
</Syncfusion:SfDataGrid>Notice I set for the SfDataGrid that doesn't allow filtering, editing, deleting or sorting and I that I specify the columns I allow to be filtered and sorted (with the specification that column sorting and filtering got priority over the general SfDataGrid).
In a command in the ViewModel I add a new item to the source collection:
this.ventas.Add(item);
This automatically refresh the SfDataGrid including the new element but after this point the SfDataGrid doesn't allow anymore to sort or filter (the filter dialog appears almost in blank).
Is this maybe a wrong approach or why the SfDataGrid lost the ability to sort and filter? I am not using the Add New Item row as I am using the SfDataGrid as a read only control to be able to use the features of sorting, filtering and summary.
The Essential Studio Version is 14.2.0.26
Thanks in advance.