Stylus.GetIsPressAndHoldEnabled(DependencyObject) Stylus.GetIsPressAndHoldEnabled(DependencyObject) Stylus.GetIsPressAndHoldEnabled(DependencyObject) Stylus.GetIsPressAndHoldEnabled(DependencyObject) Method

定義

取得所指定元素上的 IsPressAndHoldEnabled 附加屬性值。Gets the value of the IsPressAndHoldEnabled attached property on the specified element.

public:
 static bool GetIsPressAndHoldEnabled(System::Windows::DependencyObject ^ element);
[System.Windows.AttachedPropertyBrowsableForType(typeof(System.Windows.DependencyObject))]
public static bool GetIsPressAndHoldEnabled (System.Windows.DependencyObject element);
static member GetIsPressAndHoldEnabled : System.Windows.DependencyObject -> bool
Public Shared Function GetIsPressAndHoldEnabled (element As DependencyObject) As Boolean

參數

element
DependencyObject DependencyObject DependencyObject DependencyObject

使用 UIElementContentElement 可決定是否啟用按住功能。A UIElement or ContentElement on which to determine whether press and hold is enabled.

傳回

指定的項目如有啟用按住功能,則為 true;否則為 falsetrue if the specified element has press and hold enabled; otherwise, false;

範例

下列範例示範如何在上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

適用於