Hello!
I have QueryableCollectionView in my view model and i bind it to RadGridView and RadDataPager. When i use MoveCurrentTo() to set current item it work if item on the current page, but if item is not on the current page it is not works.
There is XAML of test project:
There is code for test project:
Is there simple solutions to automatically set current page on page that contains necessary item?
Thank you.
I have QueryableCollectionView in my view model and i bind it to RadGridView and RadDataPager. When i use MoveCurrentTo() to set current item it work if item on the current page, but if item is not on the current page it is not works.
There is XAML of test project:
<
Grid
x:Name
=
"LayoutRoot"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadGridView
Grid.Row
=
"0"
ItemsSource
=
"{Binding Persons}"
/>
<
telerik:RadDataPager
Grid.Row
=
"1"
Source
=
"{Binding Persons}"
/>
</
Grid
>
There is code for test project:
public
class
Person
{
public
int
Id {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
public
class
ViewModel
{
QueryableCollectionView _Persons;
public
QueryableCollectionView Persons
{
get
{
if
(_Persons ==
null
)
{
_Persons =
new
QueryableCollectionView(GetPersons());
_Persons.PageSize = 20;
Person person = (_Persons.SourceCollection
as
List<Person>).FirstOrDefault(p => p.Id == 50);
if
(person !=
null
)
_Persons.MoveCurrentTo(person);
}
return
_Persons;
}
}
List<Person> GetPersons()
{
List<Person> res =
new
List<Person>();
for
(
int
i = 1; i < 100; i++)
res.Add(
new
Person() { Id = i, Name =
"Name "
+ i });
return
res;
}
}
Is there simple solutions to automatically set current page on page that contains necessary item?
Thank you.