Table of Contents

Class TabbedThumbnail

Namespace
Microsoft.WindowsAPICodePack.Taskbar
Assembly
Microsoft.WindowsAPICodePack.Shell.dll

Represents a tabbed thumbnail on the taskbar for a given window or a control.

public class TabbedThumbnail : IDisposable
Inheritance
TabbedThumbnail
Implements
Inherited Members

Constructors

TabbedThumbnail(nint, nint)

Creates a new TabbedThumbnail with the given window handle of the parent and a child control/window's handle (e.g. TabPage or Panel)

public TabbedThumbnail(nint parentWindowHandle, nint windowHandle)

Parameters

parentWindowHandle nint

Window handle of the parent window. This window has to be a top-level window and the handle cannot be null or IntPtr.Zero

windowHandle nint

Window handle of the child control or window for which a tabbed thumbnail needs to be displayed

TabbedThumbnail(nint, Control)

Creates a new TabbedThumbnail with the given window handle of the parent and a child control (e.g. TabPage or Panel)

public TabbedThumbnail(nint parentWindowHandle, Control control)

Parameters

parentWindowHandle nint

Window handle of the parent window. This window has to be a top-level window and the handle cannot be null or IntPtr.Zero

control Control

Child control for which a tabbed thumbnail needs to be displayed

Remarks

This method can also be called when using a WindowsFormHost control in a WPF application. Call this method with the main WPF Window's handle, and windowsFormHost.Child control.

TabbedThumbnail(Window, UIElement, Vector)

Creates a new TabbedThumbnail with the given window handle of the parent and a WPF child Window. For WindowsFormHost control, use TabbedThumbnail(IntPtr, Control) overload and pass the WindowsFormHost.Child as the second parameter.

public TabbedThumbnail(Window parentWindow, UIElement windowsControl, Vector peekOffset)

Parameters

parentWindow Window

Parent window for the UIElement control. This window has to be a top-level window and the handle cannot be null

windowsControl UIElement

WPF Control (UIElement) for which a tabbed thumbnail needs to be displayed

peekOffset Vector

Offset point used for displaying the peek bitmap. This setting is recomended for hidden WPF controls as it is difficult to calculate their offset.

Properties

ClippingRectangle

Specifies that only a portion of the window's client area should be used in the window's thumbnail.

A value of null will clear the clipping area and use the default thumbnail.

public Rectangle? ClippingRectangle { get; set; }

Property Value

Rectangle?

DisplayFrameAroundBitmap

Specifies whether a standard window frame will be displayed around the bitmap. If the bitmap represents a top-level window, you would probably set this flag to true. If the bitmap represents a child window (or a frameless window), you would probably set this flag to false.

public bool DisplayFrameAroundBitmap { get; set; }

Property Value

bool

PeekOffset

Gets or sets the offset used for displaying the peek bitmap. This setting is recomended for hidden WPF controls as it is difficult to calculate their offset.

public Vector? PeekOffset { get; set; }

Property Value

Vector?

Title

Title for the window shown as the taskbar thumbnail.

public string Title { get; set; }

Property Value

string

Tooltip

Tooltip to be shown for this thumbnail on the taskbar. By default this is full title of the window shown on the taskbar.

public string Tooltip { get; set; }

Property Value

string

Methods

Dispose()

Release the native objects.

public void Dispose()

Dispose(bool)

Release the native objects.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~TabbedThumbnail()

protected ~TabbedThumbnail()

InvalidatePreview()

Invalidate any existing thumbnail preview. Calling this method will force DWM to request a new bitmap next time user previews the thumbnails or requests Aero peek preview.

public void InvalidatePreview()

SetImage(Bitmap)

Override the thumbnail and peek bitmap. By providing this bitmap manually, Thumbnail Window manager will provide the Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. Use this property to update the bitmap whenever the control is updated and the user needs to be shown a new thumbnail on the taskbar preview (or aero peek).

public void SetImage(Bitmap bitmap)

Parameters

bitmap Bitmap

The image to use.

Remarks

If the bitmap doesn't have the right dimensions, the DWM may scale it or not render certain areas as appropriate - it is the user's responsibility to render a bitmap with the proper dimensions.

SetImage(BitmapSource)

Override the thumbnail and peek bitmap. By providing this bitmap manually, Thumbnail Window manager will provide the Desktop Window Manager (DWM) this bitmap instead of rendering one automatically. Use this property to update the bitmap whenever the control is updated and the user needs to be shown a new thumbnail on the taskbar preview (or aero peek).

public void SetImage(BitmapSource bitmapSource)

Parameters

bitmapSource BitmapSource

The image to use.

Remarks

If the bitmap doesn't have the right dimensions, the DWM may scale it or not render certain areas as appropriate - it is the user's responsibility to render a bitmap with the proper dimensions.

SetWindowIcon(Icon)

Sets the window icon for this thumbnail preview

public void SetWindowIcon(Icon icon)

Parameters

icon Icon

System.Drawing.Icon for the window/control associated with this preview

SetWindowIcon(nint)

Sets the window icon for this thumbnail preview

public void SetWindowIcon(nint iconHandle)

Parameters

iconHandle nint

Icon handle (hIcon) for the window/control associated with this preview

Remarks

This method will not release the icon handle. It is the caller's responsibility to release the icon handle.

Events

TabbedThumbnailActivated

The event that occurs when a tab is activated (clicked) on the taskbar thumbnail preview.

public event EventHandler<TabbedThumbnailEventArgs> TabbedThumbnailActivated

Event Type

EventHandler<TabbedThumbnailEventArgs>

TabbedThumbnailBitmapRequested

The event that occurs when a thumbnail or peek bitmap is requested by the user.

public event EventHandler<TabbedThumbnailBitmapRequestedEventArgs> TabbedThumbnailBitmapRequested

Event Type

EventHandler<TabbedThumbnailBitmapRequestedEventArgs>

TabbedThumbnailClosed

The event that occurs when a tab is closed on the taskbar thumbnail preview.

public event EventHandler<TabbedThumbnailClosedEventArgs> TabbedThumbnailClosed

Event Type

EventHandler<TabbedThumbnailClosedEventArgs>

TabbedThumbnailMaximized

The event that occurs when a tab is maximized via the taskbar thumbnail preview (context menu).

public event EventHandler<TabbedThumbnailEventArgs> TabbedThumbnailMaximized

Event Type

EventHandler<TabbedThumbnailEventArgs>

TabbedThumbnailMinimized

The event that occurs when a tab is minimized via the taskbar thumbnail preview (context menu).

public event EventHandler<TabbedThumbnailEventArgs> TabbedThumbnailMinimized

Event Type

EventHandler<TabbedThumbnailEventArgs>

TitleChanged

This event is raised when the Title property changes.

public event EventHandler TitleChanged

Event Type

EventHandler

TooltipChanged

This event is raised when the Tooltip property changes.

public event EventHandler TooltipChanged

Event Type

EventHandler