Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransitioningContentControl issue #13493

Closed
laolarou726 opened this issue Nov 5, 2023 · 8 comments · Fixed by #13518
Closed

TransitioningContentControl issue #13493

laolarou726 opened this issue Nov 5, 2023 · 8 comments · Fixed by #13518
Labels

Comments

@laolarou726
Copy link
Contributor

Describe the bug

TCC will throw an exception when switch back to the old content:
Even I ensured control's Visual Parent is cleared:

image

I tried to write a repro but I failed to do so.

Expected behavior

Content should switch between old and new content.

Environment

  • OS: Windows 11 22H2
  • Avalonia-Version: 11.0.5

Additional context

Add any other context about the problem here.

@laolarou726 laolarou726 added the bug label Nov 5, 2023
@laolarou726
Copy link
Contributor Author

laolarou726 commented Nov 5, 2023

Okay, I just successfully created a repro for this issue:

! There are possible photosensitive epilepsy contents, and there is a 100ms fast page switching in the repro.

https://github.com/laolarou726/TCCExceptionTest

Download and build the repro, then click the Start button, then wait for a few seconds, and the exception will pop.

@laolarou726
Copy link
Contributor Author

It seems when I changing the content for a TCC that is inside another TCC will cause this issue. My repro has the similar structure.

@timunie
Copy link
Contributor

timunie commented Nov 6, 2023

are you setting the content directly? Imo it would be much safer to use DataTemplates instead of setting the content directly.

@laolarou726
Copy link
Contributor Author

are you setting the content directly? Imo it would be much safer to use DataTemplates instead of setting the content directly.

But in this case it's impossible to use the DataTemplate to replace the content setting right. I'm using the TCX as the NavigationFrame here.

@laolarou726
Copy link
Contributor Author

My current temporary solution is this:

Rewrite the Theme of the TCC like this:

<ControlTheme x:Key="{x:Type TransitioningContentControl}"
                  TargetType="TransitioningContentControl">
        <!--  Set Defaults  -->
        <Setter Property="Template">
            <ControlTemplate>
                <Panel>
                    <ContentPresenter Name="PART_ContentPresenter"
                                      Background="{TemplateBinding Background}"
                                      BorderBrush="{TemplateBinding BorderBrush}"
                                      BorderThickness="{TemplateBinding BorderThickness}"
                                      CornerRadius="{TemplateBinding CornerRadius}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      Content="{TemplateBinding Content}"
                                      Padding="{TemplateBinding Padding}"
                                      VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                      HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
                    <ContentPresenter Name="PART_TransitionContentPresenter"
                                      Background="{TemplateBinding Background}"
                                      BorderBrush="{TemplateBinding BorderBrush}"
                                      BorderThickness="{TemplateBinding BorderThickness}"
                                      CornerRadius="{TemplateBinding CornerRadius}"
                                      ContentTemplate="{TemplateBinding ContentTemplate}"
                                      Padding="{TemplateBinding Padding}"
                                      VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                      HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
            </Panel>
        </ControlTemplate>
    </Setter>
</ControlTheme>

Then everything will work just fine except all the transition animations will be loss. But the page switch will be fine.

@laolarou726
Copy link
Contributor Author

@timunie @MrJul Does this bug have anything to do with this PR #12173

@timunie
Copy link
Contributor

timunie commented Nov 7, 2023

Could be, yeah. If you test a release just before that PR was merged, is the issue resolved?

I don't know what a proper solution would be. The TCC is kind of nightmare to me 😃

/cc @danielmayost

@laolarou726 laolarou726 mentioned this issue Nov 7, 2023
3 tasks
@laolarou726
Copy link
Contributor Author

Could be, yeah. If you test a release just before that PR was merged, is the issue resolved?

I don't know what a proper solution would be. The TCC is kind of nightmare to me 😃

/cc @danielmayost

Just created a PR to fix this issue, it should be good right now. #13518

maxkatz6 pushed a commit that referenced this issue Nov 19, 2023
* Update OpenGlControlBase.cs

* Update TransitioningContentControl.cs

* bug fix and add test
maxkatz6 pushed a commit that referenced this issue Dec 5, 2023
* Update OpenGlControlBase.cs

* Update TransitioningContentControl.cs

* bug fix and add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants