MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

DialogHost IsLoaded but not exactly

Open
#3,804 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug evaluation required
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

### Bug explanation

I've uploaded a sample project illustrating the issue.

When trying to get a WPF window to open a view using DialogHost on initial startup/show, I noticed that the DialogHost.Show method throws an exception even though the DialogHost instance IsLoaded property was true. I am thinking the DialogHost is loaded but not yet registered in the LoadedInstances HashSet by the time the Window.IsLoaded event triggers.

https://github.com/jbooth88/DialogHostStartupExample

Looks like IsLoaded property is coming from FrameworkElement, so my guess here is that it's not the correct value to identify whether or not the DialogHost is fully initialized. I am not sure of the best way to solve this problem.

### Version

5.2.1

Contributor guide

Open the contributing guide

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 by reproducing the startup sequence with the linked DialogHostStartupExample project and inspect DialogHost.Show, FrameworkElement.IsLoaded, and the LoadedInstances HashSet. Determine why Show can run before registration is complete, then verify the fix against the initial window/view-opening scenario described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.