JJ.Framework.Presentation 1.5.6883.36449

Prefix Reserved
dotnet add package JJ.Framework.Presentation --version 1.5.6883.36449
                    
NuGet\Install-Package JJ.Framework.Presentation -Version 1.5.6883.36449
                    
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="JJ.Framework.Presentation" Version="1.5.6883.36449" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JJ.Framework.Presentation" Version="1.5.6883.36449" />
                    
Directory.Packages.props
<PackageReference Include="JJ.Framework.Presentation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JJ.Framework.Presentation --version 1.5.6883.36449
                    
#r "nuget: JJ.Framework.Presentation, 1.5.6883.36449"
                    
#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.
#addin nuget:?package=JJ.Framework.Presentation&version=1.5.6883.36449
                    
Install JJ.Framework.Presentation as a Cake Addin
#tool nuget:?package=JJ.Framework.Presentation&version=1.5.6883.36449
                    
Install JJ.Framework.Presentation as a Cake Tool

JJ.Framework.Presentation

Easily construct a pager view model with properties like CanGoToFirstPage, CanGoToPreviousPage, CanGoToNextPage, CanGoToLastPage.

Example call:

PagerViewModelFactory.Create(
    selectedPageNumber: 3, 
    pageSize: 10, 
    itemCount: 200, 
    maxVisiblePageNumbers: 5);

This returns:

PagerViewModel
{
    PageCount = 20,
    CanGoToFirstPage = true,
    CanGoToPreviousPage = true,
    MustShowLeftEllipsis = false,

    VisiblePageNumbers = { 1, 2, 3, 4, 5 },

    PageNumber = 3,

    MustShowRightEllipsis = true,
    CanGoToNextPage = true, 
    CanGoToLastPage = true
}

You can render it any way you want, but you might present it as follows:

<<  <  1 2 [3] 4 5 ...  >  >>

Here is an example of how you could render it with a StringBuilder:

var sb = new StringBuilder();

if (pagerViewModel.CanGoToFirstPage) sb.Append("<< ");
if (pagerViewModel.CanGoToPreviousPage) sb.Append("< ");
if (pagerViewModel.MustShowLeftEllipsis) sb.Append("... ");

foreach (int i in pagerViewModel.VisiblePageNumbers)
{
    if (i == pagerViewModel.PageNumber)
    {
        sb.Append($"[{i}] ");
    }
    else
    {
        sb.Append($"{i} ");
    }
}

if (pagerViewModel.MustShowRightEllipsis) sb.Append("... ");
if (pagerViewModel.CanGoToNextPage) sb.Append(" > ");
if (pagerViewModel.CanGoToLastPage) sb.Append(">>");
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  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
1.5.6883.36449 1,874 11/5/2018