FrameworkContentElement.ForceCursor 屬性


取得或設定值,這個值表示此 FrameworkContentElement 是否應強制使用者介面 (UI)user interface (UI) 呈現游標,如這個執行個體的 Cursor 屬性所宣告。Gets or sets a value indicating whether this FrameworkContentElement should force the 使用者介面 (UI)user interface (UI) to render the cursor as declared by this instance's Cursor property.

 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,否則為 falsetrue to force cursor presentation while over this element to use this instance's setting for the cursor (including on all child elements); otherwise false. 預設值為 falseThe default value is false.


下列範例會在專案上方強制執行游標。The following example forces the cursor while over the element.

  <StackPanel Name="CursorForced" ForceCursor="true" Cursor="Hand">
    <Label>Cursors Forced</Label>
    <TextBox>Fill me in!</TextBox>
  <StackPanel Name="CursorNotForced">
    <Label>Cursors Not Forced</Label>
    <TextBox>Fill me in!</TextBox>


將此屬性設定為 true 將會覆寫子項目所建立的資料指標喜好設定。Setting this property to true will override the cursor preferences established by child elements. 在一般應用程式 UIUI 中這麼做可能會對使用者造成混淆,特別是當子項目嘗試指定資料指標時。Doing so in general application UIUI might be confusing for the user, particularly if child elements are attempting to specify cursors. 設定 ForceCursor 更適合控制項子類別或撰寫案例。Setting ForceCursor is more appropriate in control subclassing or compositing scenarios.

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field ForceCursorProperty
設定為 true 的中繼資料屬性Metadata properties set to true NoneNone