#829 – Setting an Application-Wide Cursor from Code
May 28, 2013 Leave a comment
You can use the Cursors property of a FrameworkElement to set the cursor that the user sees when moving the mouse over that element. This cursor will also be used on descendant elements of the element where you set the cursor.
You can also set the cursor from code. You could just set the Cursor property of an individual element in code. But you can also set the static Mouse.OverrideCursor property, indicating a cursor that should be used throughout the entire application. This will override any Cursor properties of individual elements.
<StackPanel> <Label Content="Ad eundum quo nemo ante iit" Background="LightCoral" Cursor="Hand"/> <Label Content="Noli habere bovis, vir" Background="DarkSeaGreen"/> <Button Content="Ventilabis Me" Click="btnClick" HorizontalAlignment="Center"/> </StackPanel>
private void btnClick(object sender, RoutedEventArgs e) { Mouse.OverrideCursor = Cursors.AppStarting; }