Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

DesktopWindowXamlSource window in taskbar in Windows10 while using WindowsXamlHostElement with CaptureElement #354

@Eugen00-00

Description

@Eugen00-00

Describe the bug

I see DesktopWindowXamlSource window in taskbar in Windows10 after a dialog with WindowsXamlHostElement and CaptureElement as a WindowsXamlHostElement child is closed.
There is a test WPF application. Main window contains only a buttton that opens another dialog. This dialog has olny WindowsXamlHostElement

  <Grid>
        <xamlhost:WindowsXamlHost x:Name="XamlHost1" />
</Grid>

or with InitialTypeName (it makes no difference)

  <Grid>
        <xamlhost:WindowsXamlHost x:Name="XamlHost1" InitialTypeName="Windows.UI.Xaml.Controls.CaptureElement"/>
</Grid>

In the dialog constructor:
XamlHost1.Child = new CaptureElement();

Optionally it can be done (it makes no difference)

XamlHost1.ChildChanged += XamlHost_ChildChanged;
...
//closed event handler
 private void OnDialogClosed(object sender, EventArgs e)
        {
            XamlHost1.Child = null;
        }

       private void XamlHost_ChildChanged(object sender, EventArgs e)
        {
            var xh = sender as WindowsXamlHost;
            if(xh != null && !xh.IsDisposed)
            {
               xh.Dispose();
            }
        }

On button press the dialog appears, after dailog is closed one can see a DesktopWindowXamlSource window in taskbar.
It is reproducible on Windows10 22H2, but not reproducible on Windows11.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

I don't want to see DesktopWindowXamlSource window in taskber after dialog is closed.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 
<packages>
  <package id="Microsoft.Toolkit.UI.XamlHost" version="6.1.2" targetFramework="net472" />
  <package id="Microsoft.Toolkit.Win32.UI.SDK" version="6.1.2" targetFramework="net472" />
  <package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.1.2" targetFramework="net472" />
  <package id="Microsoft.Toolkit.Wpf.UI.XamlHost" version="6.1.2" targetFramework="net472" />
  <package id="Microsoft.Windows.SDK.Contracts" version="10.0.18362.2005" targetFramework="net472" />
  <package id="System.Runtime.WindowsRuntime" version="4.6.0" targetFramework="net472" />
  <package id="System.Runtime.WindowsRuntime.UI.Xaml" version="4.6.0" targetFramework="net472" />
</packages>

Package Version(s): 
Microsoft.Toolkit.Wpf.UI.XamlHost v. 6.1.2
Microsoft.Windows.SDK.Contracts v. 10.0.18362.2005

Project .NET Version:
- [x ] .NET Framework (version:  4.7.2)
- [ ] .NET Core 3
- [ ] .NET Core 3.1 Preview (version: )

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (build number: )
- [ ] Windows10 22H2

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [ ] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [ x] 2019 (version: 16.11.24) 
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions