FrameworkElement.ForceCursor 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定一個值,指示是否 FrameworkElement 應該強制使用者介面(UI)依照屬性宣告 Cursor 的方式渲染游標。
public:
property bool ForceCursor { bool get(); void set(bool value); };
public bool ForceCursor { get; set; }
member this.ForceCursor : bool with get, set
Public Property ForceCursor As Boolean
屬性值
true 如果游標在該元素上方顯示,必須使用目前 Cursor 的游標設定(包括所有子元素);否則 false。 預設值為 false。
範例
以下範例強制執行游標值。
<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 將覆蓋由子元素所建立的游標偏好。 在一般應用程式介面中這麼做可能會讓使用者感到困惑,尤其是當子元素試圖指定游標時。 設定 ForceCursor 在控制子類別或合成場景中更為適用。
相依財產資訊
| Item | 價值觀 |
|---|---|
| 識別碼欄位 | ForceCursorProperty |
元資料屬性設為 true |
None |