Hi,
I am using the RadDataPager control in a grid manually without setting a PagedSource or a Source. I have a ViewModel Command connected to the PageIndexChange using a behavior I created and it works fine, but in the code-behind of my view I set the PageIndex of the control to 0 sometimes. This doesn't trigger the event, and in another thread it was said that this was by design, that only when the PageIndex is changed by the control itself it triggers.
What I would expect though would be the event being called when the PageIndex is changed, whoever changed it. How could I get my Command to be called when I set the PageIndex myself without breaking the MVVM pattern? What I want to avoid is this in the code-behind of my view but it's the only thing I can think of to do what I want :
Do you have any idea how I can achieve this?
I am using the RadDataPager control in a grid manually without setting a PagedSource or a Source. I have a ViewModel Command connected to the PageIndexChange using a behavior I created and it works fine, but in the code-behind of my view I set the PageIndex of the control to 0 sometimes. This doesn't trigger the event, and in another thread it was said that this was by design, that only when the PageIndex is changed by the control itself it triggers.
What I would expect though would be the event being called when the PageIndex is changed, whoever changed it. How could I get my Command to be called when I set the PageIndex myself without breaking the MVVM pattern? What I want to avoid is this in the code-behind of my view but it's the only thing I can think of to do what I want :
public
void
ResetDataPager()
{
if
(DataPager.PageIndex > 0)
{
DataPager.PageIndex = 0;
// not MVVM
var vm = (MyViewModel)DataPager.DataContext;
vm.ChangePageIndex.Execute(DataPager.PageIndex);
}
}
Do you have any idea how I can achieve this?