This question is locked. New answers and comments are not allowed.
Hello
Hope you can see what is wrong in the code below.
<telerik:RadGridView
ColumnWidth="*"
Grid.Row="2"
IsBusy="{Binding IsLoadingDataEntries}"
ItemsSource="{Binding DataEntries}"
EnableRowVirtualization="True"
Margin="0,10,0,0"
SelectionMode="Extended">
<i:Interaction.Behaviors>
<controls:SelectedItemsBehavior SelectedItems="{Binding ViewModel.SelectedDataEntries, Source={StaticResource Container}}"/>
</i:Interaction.Behaviors>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Category.Name}" Header="Kategori" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Classification}" Header="Klassifisering" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Date, StringFormat=d}" Header="Datum" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Amount, Converter={StaticResource NumberToStringConverter}}" Header="Värde" DataFormatString="{}{0:N2}" TextAlignment="Right" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Private _dataEntries As VirtualQueryableCollectionView(Of DataEntry)
Public Sub New(objectService As IObjectService)
_dataEntries = New VirtualQueryableCollectionView(Of DataEntry)()
...
DataEntries.LoadSize = 50
...
AddHandler DataEntries.ItemsLoading, AddressOf OnDataEntriesLoading
...
end sub
Public ReadOnly Property DataEntries As VirtualQueryableCollectionView(Of DataEntry)
Get
Return _dataEntries
End Get
End Property
Private Sub OnDataEntriesLoading(sender As Object, e As VirtualQueryableCollectionViewItemsLoadingEventArgs)
LoadDataEntries(e.StartIndex, e.ItemCount)
End Sub
Private Sub LoadDataEntries(startIndex As Integer, itemCount As Integer)
IsLoadingDataEntries = True
ObjectService.GetDataEntries(
startIndex, itemCount,
Sub(result)
DataEntries.VirtualItemCount = result.TotalItemCount
DataEntries.Load(startIndex, result.Items)
CreateNewEntry()
IsLoadingDataEntries = False
End Sub)
End Sub
Regards
Olena
Hope you can see what is wrong in the code below.
<telerik:RadGridView
ColumnWidth="*"
Grid.Row="2"
IsBusy="{Binding IsLoadingDataEntries}"
ItemsSource="{Binding DataEntries}"
EnableRowVirtualization="True"
Margin="0,10,0,0"
SelectionMode="Extended">
<i:Interaction.Behaviors>
<controls:SelectedItemsBehavior SelectedItems="{Binding ViewModel.SelectedDataEntries, Source={StaticResource Container}}"/>
</i:Interaction.Behaviors>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Category.Name}" Header="Kategori" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Classification}" Header="Klassifisering" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Date, StringFormat=d}" Header="Datum" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Amount, Converter={StaticResource NumberToStringConverter}}" Header="Värde" DataFormatString="{}{0:N2}" TextAlignment="Right" IsFilterable="True" IsGroupable="True" ShowDistinctFilters="False"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Private _dataEntries As VirtualQueryableCollectionView(Of DataEntry)
Public Sub New(objectService As IObjectService)
_dataEntries = New VirtualQueryableCollectionView(Of DataEntry)()
...
DataEntries.LoadSize = 50
...
AddHandler DataEntries.ItemsLoading, AddressOf OnDataEntriesLoading
...
end sub
Public ReadOnly Property DataEntries As VirtualQueryableCollectionView(Of DataEntry)
Get
Return _dataEntries
End Get
End Property
Private Sub OnDataEntriesLoading(sender As Object, e As VirtualQueryableCollectionViewItemsLoadingEventArgs)
LoadDataEntries(e.StartIndex, e.ItemCount)
End Sub
Private Sub LoadDataEntries(startIndex As Integer, itemCount As Integer)
IsLoadingDataEntries = True
ObjectService.GetDataEntries(
startIndex, itemCount,
Sub(result)
DataEntries.VirtualItemCount = result.TotalItemCount
DataEntries.Load(startIndex, result.Items)
CreateNewEntry()
IsLoadingDataEntries = False
End Sub)
End Sub
Regards
Olena