VPaged.WF 2.0.1

dotnet add package VPaged.WF --version 2.0.1
NuGet\Install-Package VPaged.WF -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VPaged.WF" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VPaged.WF --version 2.0.1
#r "nuget: VPaged.WF, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VPaged.WF as a Cake Addin
#addin nuget:?package=VPaged.WF&version=2.0.1

// Install VPaged.WF as a Cake Tool
#tool nuget:?package=VPaged.WF&version=2.0.1

VPaged.WF Pagination component for .NET desktop application

This library will help you to paginate desktop application easily with C#. Source : https://github.com/tranthanhvan/VPaged.WF

Install

dotnet add package VPaged.WF --version 2.0.1

How to Use

With Winform application

Initialize a VPag with the current Form ,set method you use to get data & totalCount in SelectDataMaster & SelectCountMaster properties:
    public partial class FrmEmployee : Form
    {
        private readonly VPagedContext _context;

        private VPagination _pag;

        public FrmEmployee()
        {
            InitializeComponent();
            _context = new VPagedContext();
            //Initilizer VPaged.WF. `this.groupPaging` is System.Windows.Forms.GroupBox type Winform Base
            _pag = new VPagination(this.ContainerPaging, pageSize: 3);
            //Set method Select Data
            _pag.SelectDataMaster = SelectData;
            //Set method get count need paging
            _pag.SelectCountMaster = GetCount;
        }

         /// <summary>
        /// Method VPaged SelectDataMaster
        /// </summary>
        private void SelectData()
        => GridMaster.DataSource = _context.Employees.OrderBy(p => p.ID).Skip((_pag.PageIndex - 1) * _pag.PageSize)
                                    .Take(_pag.PageSize).ToList(); //GridMaster is DataGridView

        /// <summary>
        /// Method VPaged SelectCountMaster
        /// </summary>
        /// <returns>total count need paging</returns>
        private long GetCount() => _context.Employees.Count();
    }
VPagRunOrRefresh() method used to run get data or can also refresh data after insert/update or delete . After Initialize a VPag , call VPagRunOrRefresh() Method to run. ex i will run VPag get Data and paging when Form load events :
    private void FrmEmployee_Load(object sender, EventArgs e)
    {
	_pag.VPagRunOrRefresh();
    }
Or create a button with click event is run VPaged :
    private void BtnLoad_Click(object sender, System.EventArgs e)
    {
        _pag.VPagRunOrRefresh();
    }

With WPF application

it's still the same. just create System.WindowForms.Control to initialize VPaged . eg :
    <WindowsFormsHost Margin="257,237,276,354" Width="500" Height="50" Name="HostNamePagingWF">
        <wf:Control x:Name="ContainerPaging" Text="Here" Height="48" Width="370"/>
    </WindowsFormsHost>
The rest is similar to the window form application:
    public partial class MainWindow : Window
    {
        private readonly VPagedContext _context;

        private VPagination _pag;

        public MainWindow()
        {
            InitializeComponent();
            _context = new VPagedContext();
            //Initilizer VPaged.WF. `this.groupPaging` is System.Windows.Forms.GroupBox type Winform Base
            _pag = new VPagination(ContainerPaging, pageSize: 3); //ContainerPaging is child WindowsFormsHost
            //Set method Select Data
            _pag.SelectDataMaster = SelectData;
            //Set method get count need paging
            _pag.SelectCountMaster = GetCount;
        }

        /// <summary>
        /// Method VPaged SelectDataMaster
        /// </summary>
        private void SelectData()
        => GridView.ItemsSource = _context.Employees.OrderBy(p => p.ID).Skip((_pag.PageIndex - 1) * _pag.PageSize)
                                    .Take(_pag.PageSize).ToList();

        /// <summary>
        /// Method VPaged SelectCountMaster
        /// </summary>
        /// <returns>total count need paging</returns>
        private long GetCount() => _context.Employees.Count();

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _pag.VPagRunOrRefresh();
        }
    }
Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 440 1/2/2023
2.0.0 279 1/1/2023
1.0.5 292 12/31/2022
1.0.4 286 12/31/2022
1.0.3 389 8/18/2022
1.0.2 374 8/17/2022

Optimize version