#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>


Advertisements

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: