HandyOrg / HandyOrg/HandyControl

在使用Pagination时,发现一个问题 BUG

Open
#1,435 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

在使用Pagination时,发现一个问题 BUG

Steps to reproduce the bug

在使用Pagination时,发现一个问题
场景:
页面布局是 DataGrid 上面是各种筛选框,下方是 Pagination
XAML代码:<hc:Pagination Grid.Row="2" MaxPageCount="{Binding PageCount}" PageIndex="{Binding PageIndex,Mode=OneWay}" IsJumpEnabled="True" HorizontalAlignment="Right"> <hc:Interaction.Triggers> <hc:EventTrigger EventName="PageUpdated"> <hc:EventToCommand Command="{Binding PagingChangedCommand}" PassEventArgsToCommand="True" /> </hc:EventTrigger> </hc:Interaction.Triggers> </hc:Pagination>
image
1、先是通过 Pagination 进行分页切换并读取相应数据到 DataGrid
2、然后使用筛选框进行数据筛选,并将 ViewModel 里的 PageIndex 重置到 1,可是 Pagination 的活动页码没有变为 1
经测试,如果初始化页面,将数据及 ViewModel 里的 PageIndex 设置成 大于 1,后面再用筛选条件筛选数据并将ViewModel 里的 PageIndex 设为 1 , Pagination 的活动页码是可以变为 1。
也就是说只要通过 Pagination 切换了,分页后,就不能用 ViewModel里的 PageIndex 来改变控件的页码了

Expected behavior

不管有没有使用控件来切换过分页,都能使用 ViewModel 里的 PageIndex 来设置控件的 PageIndex

Screenshots

No response

NuGet package version

HandyControl 3.4.0

IDE

Visual Studio 2022

Framework type

.Net 6.0

Windows version

Windows 11 (22000)

Additional context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Pagination control and its PageIndex binding behavior, using the XAML example with PageUpdated and the ViewModel's PageIndex. Reproduce the sequence of changing pages, filtering the DataGrid, and resetting PageIndex to 1. Done means the Pagination active page changes to 1 in both cases, including after user paging.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.