FrameworkElement.ForceCursor 屬性

定義

取得或設定值,這個值表示這 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

屬性值

Boolean

如果游標位於此項目上方時,強制游標展示使用目前游標的 Cursor 設定 (包括在所有子項目上) 則為 true,否則為 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 ,將會覆寫子項目所建立的資料指標喜好設定。 在一般應用程式 UI 中這麼做可能會對使用者造成混淆,特別是當子項目嘗試指定資料指標時。 在控制項子類別化或撰寫案例中,設定 ForceCursor 更適合。

相依性屬性資訊

識別碼欄位 ForceCursorProperty
中繼資料屬性設定為 true

適用於

另請參閱