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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
- System.Windows.Forms (>= 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Optimize version