StylusButtonCollection.GetStylusButtonByGuid Method (Guid)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the StylusButton that the specified GUID identifies.

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public StylusButton GetStylusButtonByGuid(
	Guid guid


Type: System.Guid

The Guid that specifies the desired StylusButton.

Return Value

Type: System.Windows.Input.StylusButton

The StylusButton of the specified GUID.

The StylusPointProperties class contains a StylusPointProperty for the tip and barrel buttons on a tablet pen. Use the Id property to get the GUID associated with a button.

The following example demonstrates how to get the StylusButtonState of the barrel button.

void textbox1_StylusInRange(object sender, StylusEventArgs e)
    StylusButtonCollection buttons = e.StylusDevice.StylusButtons;

    StylusButton barrelButton = buttons.GetStylusButtonByGuid(StylusPointProperties.BarrelButton.Id);
    if (barrelButton != null)



.NET Framework
Available since 3.0
Return to top