Skip to content

当 TransitioningContentControl 放在 TabControl 初始选中的 TabItem 中时,它不会重新播放其过渡动画 #1803

@CT-zydrawer

Description

@CT-zydrawer

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

PixPin_2026-06-06_21-35-47.mp4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions