FrameworkElement.ForceCursor FrameworkElement.ForceCursor FrameworkElement.ForceCursor FrameworkElement.ForceCursor Property

定義

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

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

屬性值

如果游標位於此項目上方時,強制游標展示使用目前游標的 Cursor 設定 (包括在所有子項目上) 則為 true,否則為 falsetrue if cursor presentation while over this element is forced to use current Cursor settings for the cursor (including on all child elements); otherwise false. 預設值為 falseThe default value is false.

範例

下列範例會強制執行資料指標值。The following example forces the cursor value.

<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為, 將會覆寫子專案所建立的資料指標喜好設定。If you set this property to true you 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
中繼資料屬性設定為trueMetadata properties set to true None

適用於

另請參閱