#662 – IsMouseOver Property

Every UIElement object has an IsMouseOver property that indicates whether or not the mouse is currently located over the element.

In the example below, we define a Label whose content is bound to the current state of the IsMouseOver property for a Button.

    <StackPanel Margin="20">
        <Button Name="btn1" Content="Move Mouse Over Me !" HorizontalAlignment="Center" Padding="10,5"/>
        <Label Content="{Binding ElementName=btn1, Path=IsMouseOver}" Foreground="Green"/>
    </StackPanel>


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

3 Responses to #662 – IsMouseOver Property

  1. Pingback: Dew Drop – October 5, 2012 (#1,416) | Alvin Ashcraft's Morning Dew

  2. Pingback: #663 – How IsMouseOver Works for Nested Elements « 2,000 Things You Should Know About WPF

  3. Pingback: #664 – MouseEnter and MouseLeave Events « 2,000 Things You Should Know About WPF

Leave a comment