Does PageIndex not support binding?

PageIndex can not notify binding property to update


1 Reply 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team July 24, 2023 02:34 PM UTC

Hi Sherlock,

Your requirement to notify PageIndex property changes reflection in SfDataPager can be achieved by setting Mode as TwoWay for PageIndex property and implementing the INotifyPropertyChanged. Refer to the below code snippet,


XAML Code snippet:

<syncfusion:SfDataPager x:Name="dataPager" Grid.Row="1" 

                        PageSize="5"

                        Source="{Binding Orders}"

                        PageIndex="{Binding PageIndex,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />


C# Code snippet:

public class ViewModel : INotifyPropertyChanged

{  

 

    private int _pageIndex=1;

    public int PageIndex

    {

        get { return _pageIndex; }

        set

        {

            if (_pageIndex != value)

            {

                _pageIndex = value;

                OnPropertyChanged("PageIndex");      

            }

        }

    }

}


Find the sample demo in the attachment.

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_8a1b8d6f.zip

Marked as answer
Loader.
Up arrow icon