Search code examples
xmlwpftaskbar

WPF / XAML TaskbarItemInfo : how to remove blank area for ThumbButtons?


I am using Window.TaskbarItemInfo in order to set Overlay icons and show Progress state. This works well, however, even though I have no ThumbButtons set there is still a blank area for those buttons shown below the Thumbnail.

I can easily add buttons but not collapse that area. I tried explicitly setting the ThumbButtonInfos property to null or an empty collection. Any ideas?


Solution

  • I don't think it's possible with using the WPF provided TaskbarItemInfo.

    I would look into the packages called WindowsAPICodePack created by Microsoft.

    You have to install this and this for it.

    After your window has loaded you can set the overlay icon and progress state through the Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager class. Example:

    private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
    {
        var bitmap = new Bitmap("d:\\icon.png"); // or get it from resource
        var iconHandle = bitmap.GetHicon();
        var icon = System.Drawing.Icon.FromHandle(iconHandle);
    
        TaskbarManager.Instance.SetOverlayIcon(this, icon, "Accessibility Text");
        TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Indeterminate, this);
    }
    

    Result:

    result

    You can see that I have an overlay and a progress bar set, but I don't have the empty button panel below the thumbnail.