HandyOrg / HandyOrg/HandyControl
当 TransitioningContentControl 放在 TabControl 初始选中的 TabItem 中时,它不会重新播放其过渡动画
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
当 TransitioningContentControl 放在 TabControl 的第一个 TabItem(索引0)中时,从其他 Tab 切回来不会触发过渡动画
非首个 TabItem(索引>=1)中的 TransitioningContentControl 动画正常
Steps to reproduce the bug
<TabControl> <TabItem Header="Tab 1"> <hc:TransitioningContentControl TransitionMode="Right2LeftWithFade"> <TextBlock Text="Page 1"/> </hc:TransitioningContentControl> </TabItem> <TabItem Header="Tab 2"> <hc:TransitioningContentControl TransitionMode="Right2LeftWithFade"> <TextBlock Text="Page 2"/> </hc:TransitioningContentControl> </TabItem> </TabControl>
1.从Item1(默认选中)切回到tem2,
2.再从Item2切回Item1
Expected behavior
每次 TabItem被选中时都应该播放过渡动画,包括最初选IsSelected的TabItem。
稳定的解决方案:在索引0位置添加一个隐藏的空白 TabItem 占位,让实际内容从索引1开始,如
<TabItem Visibility="Hidden" Width="0"> <hc:TransitioningContentControl TransitionMode="Right2LeftWithFade" /> </TabItem>
Screenshots
https://github.com/user-attachments/assets/3047a36f-2f84-4acf-8d46-7a9ef073f428
NuGet package version
HandyControl 3.5.1
IDE
Visual Studio 2022-preview
Framework type
.Net 8.0
Windows version
Windows 11 (22000)
Additional context
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TransitioningContentControl implementation and how it responds to TabControl or TabItem selection changes. Reproduce the provided two-tab example on .NET 8 and compare the first and second TabItems; done means the transition animation plays every time either TabItem is selected, including index 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100