Skip to content

ContentPresenter: DataContext of Page is null, even after correct Ctrl_Loaded() #19641

Open
@MichaelJachan

Description

@MichaelJachan

Current behavior

After discussing with @MartinZikmund I would like to present this bug.

In the OuterCtrl, we use a ContentPresenter to switch between 2 different Subpages Lowpass.xaml and Highpass.xaml.

We want to use the ContentPresenter, because only the active Page.xml will be instantiated, no other one will be.

In the DataContext, we transport our ViewModels.

BUG: After any of the two pages is correcty loaded, having a DataContext of the type of the respective page-ViewModel, ===> SOMETIMES the DataContext changes to null. See comments in LowPassCtrl.xaml.cs.

To reproduce the bug, switch the active page 2 or 3 times while editing also the content of the respective TextBox.

UnoApp1.zip

Expected behavior

No response

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/bugSomething isn't workingtriage/untriagedIndicates an issue requires triaging or verification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions