Mouse.OverrideCursor Property
Gets or sets the cursor for the entire application.
Namespace: System.Windows.Input
Assembly: PresentationCore (in PresentationCore.dll)
Property Value
Type: System.Windows.Input.CursorThe override cursor or null if the OverrideCursor is not set.
The following example shows an event handler for a RadioButton that is used to toggle the scope of a cursor change between a single element and the entire application. If the control that raised the event is the rbScopeElement RadioButton, a flag that denotes the scope of the cursor change is set and OverrideCursor is set to null. If the control that raised the event is the rbScopeApplication RadioButton, a flag that denotes the scope of the cursor change is set and OverrideCursor is set to the Cursor property of the Border control named DisplayArea.
// Determines the scope the new cursor will have. // // If the RadioButton rbScopeElement is selected, then the cursor // will only change on the display element. // // If the Radiobutton rbScopeApplication is selected, then the cursor // will be changed for the entire application // private void CursorScopeSelected(object sender, RoutedEventArgs e) { RadioButton source = e.Source as RadioButton; if (source != null) { if (source.Name == "rbScopeElement") { // Setting the element only scope flag to true cursorScopeElementOnly = true; // Clearing out the OverrideCursor. Mouse.OverrideCursor = null; } if (source.Name == "rbScopeApplication") { // Setting the element only scope flag to false cursorScopeElementOnly = false; // Forcing the cursor for all elements. Mouse.OverrideCursor = DisplayArea.Cursor; } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.