Thank you for reaching out. This behavior typically occurs when the about window (or page) is being created on a non-UI thread or when it's being instantiated as the wrong type (page instead of window)
In WPF, only the main UI thread has access to visual and dependency objects (XAML elements). If the ShowDialog() or Show () call is invoked from another thread, the content may not render properly- resulting in an empty or blank window.
Resolution Steps
1. Ensure the about window is defined as a window.
- Confirm that your About.xaml file begins with:
<Window x:Class=”YourAppNameSpace.About”
Xmlns=”
Xmlns=
Title=”About” Height=”300” Width=”400”>
- If it starts with <Page> instead of <Window>, you will need to host it within a window to show it usingShowDialog():
Window aboutWindoe=new Window
{
};
aboutWindow.ShowDialog();
**2. **Run window creation on the main UI dispatcher
make sure you create and show the new window on the UI thread:
private void OnAboutSelected()
{
Var aboutWindow = new About();
AboutWindow.Owner = Application.Current.MainWindow;
aboutWindow.ShowDialog();
});
**3. **Check build option and namespace
- right click on About.xaml-> properties insure build action= Page and Custom Tool=MSBuild:Complie.
- Verify the namespace in your About.xaml.cs matches your project structure.
**4. **Avoid creating UI elements in background threads
if you are calling OnAboutSelected() show an asynchronous background operation, ensure it Marshals back to the UI thread using Dispatcher.Invoke() before interacting with UI components.
Additional Diagnostic Step
If the issue persists, test by directly launching the About window from MainWindow:
Var aboutWindow = new About();
aboutWindow.ShowDialog();
if this works correctly, it confirms that the issue lies with cross thread UI access.
References:
- https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/threading-model?view=netdesktop-8.0
- https://learn.microsoft.com/en-us/dotnet/api/system.windows.threading.dispatcher.invoke?view=windowsdesktop-8.0
- https://learn.microsoft.com/en-us/dotnet/desktop/wpf/?view=netdesktop-8.0
Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer".