user966379
user966379

Reputation: 2983

Why does my WPF dialog appear in my task manager -> application?

I have added a new dialog in my existing wpf application (say Myapplication.exe). My dialog name is MyDialog.

When executing Myapplication.exe, the application launches. It is working fine.

But after opening MyDialog, I found a MyDialog entry in Task manager -> Applications. If I close this dialog, it disappears.

I don't know what is happening? Please help.

Created dialog in visual studio using following steps:

Project property -> Add -> Add new item -> WPF -> User control (wpf).

However, under WPF, there is only one option "User Control(WPF)". There is no other options (like Page, Window). That is also strange.

Added code:

<base:WpfModalDialog x:Class="MapInfo.MiPro.MiTileServer.WMTSControl"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      Width="650" Height="600"
      xmlns:local="clr-namespace:MapInfo.MiPro.MiTileServer"
      Title="Open WMTS Table"
      xmlns:base="clr-namespace:MapInfo.MiPro.Base;assembly=mibase"
      d:DesignHeight="300" d:Des6ignWidth="300">
    <Grid>
    ....
    </Grid>
</base:WpfModalDialog>

Upvotes: 1

Views: 625

Answers (1)

spacebread
spacebread

Reputation: 531

I have not tested this but you might try setting the owner of your dialog window that I found suggested here.

If you try setting the Owner property of the windows you don't want to appear, then they won't be listed in the Task List. Only ownerless windows appear to get listed.

and they suggest as well

You can use ShowInTaskbar="False" in the window xaml file.

I also found a similar SO question that has been answered Stop windows from showing up as 'tasks' from task manager WPF c#.

Upvotes: 1

Related Questions