Skip to content

Ability to show a non-modal WPF window #40

Answered by reduckted
StevenRasmussen asked this question in Q&A
Discussion options

You must be logged in to vote

@StevenRasmussen Have you tried creating and showing the modal in a separate thread? The code below seems to work for me, but I'm not sure if I'm doing something that I shouldn't. I seem to recall @AArnott saying not to use dispatchers in Visual Studio, but I can't remember where he said that. It may have been in this Remote Office Hours video.

private void ShowNonBlockingModal()
{
    var thread = new Thread(() =>
        {
            try
            {
                SynchronizationContext.SetSynchronizationContext(
                    new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher)
                );

                var dialog = new ThemeWindowDialog()

Replies: 4 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@AArnott
Comment options

@StevenRasmussen
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@StevenRasmussen
Comment options

@yannduran
Comment options

@StevenRasmussen
Comment options

@yannduran
Comment options

Comment options

You must be logged in to vote
2 replies
@AArnott
Comment options

@StevenRasmussen
Comment options

Answer selected by StevenRasmussen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants