silverlightsilverlight-5.0datapager

Jump to selected page using DataPager Control in Silverlight


I have two buttons in My View. One is Download Book and other is View Book. When i click on the View button I navigate to other page and Save the DataPager Current page. and on navigating back i have to show the Previously saved page in DataPager.

Is there any Method or property which i can use to Jump to Selected Page in DataPager Control in Silverlight 5.

I have get the Current Page number using the PageIndex but could not find a way to Navigate back to the same page. Every time The Page is starting From 1 and PageIndex 0.

Any help will be Appreciated. Thanx in advance.


Solution

  • Just make an event like

    ((BooksViewModel)LayoutRoot.DataContext).PropertyChanged += new PropertyChangedEventHandler(BooksView_PropertyChanged);
    

    and call the

    void BooksView_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "AnyDistinguishedstring")
            {
                Pager.PageIndex = 4; //it will take you to the page 5
            }
        }
    

    and From Viewmodel call the

    NotifyPropertyChanged("AnyDistinguishedstring");
    

    will do the trick. :)