Stylus.SetIsPressAndHoldEnabled(DependencyObject, Boolean) Stylus.SetIsPressAndHoldEnabled(DependencyObject, Boolean) Stylus.SetIsPressAndHoldEnabled(DependencyObject, Boolean) Stylus.SetIsPressAndHoldEnabled(DependencyObject, Boolean) Method

定義

設定所指定元素上的 IsPressAndHoldEnabled 附加屬性值。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)

參數

element
DependencyObject DependencyObject DependencyObject DependencyObject

要在其上啟用按住不放的 UIElementContentElementThe UIElement or ContentElement on which to enable press and hold.

enabled
Boolean Boolean Boolean Boolean

true 表示啟用按住不放, false 表示停用按住不放。true to enable press and hold; false to disable press and hold.

範例

下列範例示範如何在上Slider啟用按住按住。The following example demonstrates how to enable press and hold on a Slider. 這個範例假設有一個Slider呼叫。 horizontalSlider1This 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

備註

按住對應以滑鼠右鍵按一下滑鼠。Press and hold maps to the right-click on a mouse. 在 Windows Vista 中, 如果您預見到使用者可能會按住 tablet 畫筆而不想模擬按滑鼠右鍵的情況, 您可以在專案上停用這種行為。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.

適用於