Modeless WPF dialog not rendering control content.

Leo Ayala 21 Reputation points

I have a WPF app that upon startup, it shows a modeless dialog while it connects to a WCF service and retrieves some data. Once data is received, the modeless dialog is closed. The modeless dialog during startup is displayed correctly.

The data retrieved from the WCF service is displayed in a ListView. When an item is double-clicked, the same modeless dialog is displayed (with different title and message) until the item's properties are retrieved from the WCF service. When the properties are retrieved, the modeless dialog is closed, and a new dialog is displayed showing the item's properties. It is during this process of retrieving the item's properties that the modeless dialog does not render correctly. The modeless dialog contains a textbox and button. The textbox shows a message to the user and the button allows the user to cancel the operation. The dialog is shown with the correct title but the message text and cancel button are not shown. This is the same dialog that displayed correctly during startup.

My understanding of a modeless dialog is that when the Show() method is called on it, it returns immediately, and the code continues executing. The only thing I can think of is that the app is too busy doing other stuff while it waits for the item properties to be returned and this does not allow the modeless dialog to finish rendering.

The dialog is defined in a general-purpose library. It is very basic containing only a textbox and button and public properties that set their values.

Why would the modeless dialog not render correctly?

Any help would be greatly appreciated.


A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
778 questions
{count} votes

Accepted answer
  1. Sam of Simple Samples 5,516 Reputation points

    Yes, the problem very well can be that the app is busy doing other stuff and does not allow the modeless dialog to thoroughly render. You can use a BackgroundWorker to do the other processing. There are other ways to do it and many articles. The important thing is that you need to create another task for doing other processing. The main thread is the one that creates the windows. You need to avoid keeping it busy.

    0 comments No comments

0 additional answers

Sort by: Most helpful