Edit

Share via


Stylus.SetIsPressAndHoldEnabled(DependencyObject, Boolean) Method

Definition

Sets the value of the IsPressAndHoldEnabled attached property on the specified element.

public:
 static void SetIsPressAndHoldEnabled(System::Windows::DependencyObject ^ element, bool enabled);
public static void SetIsPressAndHoldEnabled (System.Windows.DependencyObject element, bool enabled);
static member SetIsPressAndHoldEnabled : System.Windows.DependencyObject * bool -> unit
Public Shared Sub SetIsPressAndHoldEnabled (element As DependencyObject, enabled As Boolean)

Parameters

element
DependencyObject

The UIElement or ContentElement on which to enable press and hold.

enabled
Boolean

true to enable press and hold; false to disable press and hold.

Examples

The following example demonstrates how to enable press and hold on a Slider. This example assumes that there is a Slider called horizontalSlider1.

if (!Stylus.GetIsPressAndHoldEnabled(horizontalSlider1))
{
    Stylus.SetIsPressAndHoldEnabled(horizontalSlider1, true);
}
If Not Stylus.GetIsPressAndHoldEnabled(horizontalSlider1) Then
    Stylus.SetIsPressAndHoldEnabled(horizontalSlider1, True)
End If

Remarks

Press and hold maps to the right-click on a mouse. In Windows Vista, you can disable this behavior on elements if you foresee a situation where the user might hold the tablet pen down without intending to simulate a right-click.

Applies to