FrameworkElement.ForceCursor 屬性
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,這個值表示這 FrameworkElement 是否應該強制使用者介面 (UI) 轉譯資料指標,如 屬性所 Cursor 宣告。
public:
property bool ForceCursor { bool get(); void set(bool value); };
C#
public bool ForceCursor { get; set; }
member this.ForceCursor : bool with get, set
Public Property ForceCursor As Boolean
如果游標位於此項目上方時,強制游標展示使用目前游標的 Cursor 設定 (包括在所有子項目上) 則為 true
,否則為 false
。 預設值是 false
。
下列範例會強制資料指標值。
XAML
<StackPanel
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<StackPanel Name="CursorForced" ForceCursor="true" Cursor="Hand">
<Label>Cursors Forced</Label>
<TextBox>Fill me in!</TextBox>
</StackPanel>
<StackPanel Name="CursorNotForced">
<Label>Cursors Not Forced</Label>
<TextBox>Fill me in!</TextBox>
</StackPanel>
</StackPanel>
如果您將此屬性設定為 true
,將會覆寫子項目所建立的資料指標喜好設定。 在一般應用程式 UI 中這麼做可能會對使用者造成混淆,特別是當子項目嘗試指定資料指標時。 在控制項子類別化或撰寫案例中,設定 ForceCursor 更適合。
識別碼欄位 | ForceCursorProperty |
中繼資料屬性設定為 true |
無 |
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
Windows Desktop | 3.0, 3.1, 5, 6, 7 |