title: How to check if mouse is over a button in wpf
body: <p>Before I start, I have to say this. I have read <a href="https://stackoverflow.com/questions/12638179/time-delay-on-trigger">this question</a>. And I dont see how its a duplicate of <a href="https://stackoverflow.com/questions/12908968/how-to-check-if-mouse-is-over-a-button-in-wpf">this question</a> that I posted a few hours ago.</p>
  
  <p>My original post as it is:</p>
  
  <p>I am using a few buttons in WPF for displaying images from various folders. The <code>Click</code> mode for all the buttons is <code>Hover</code>. For some button, after hovering, it is routed to a function <code>OnButtonClick</code>. What I want to do is, ONLY after the mouse is over the button for <code>X</code> seconds, the processing inside the function <code>OnButtonClick</code> should be done.</p>
  
  <p>XAML Code:</p>
  
  <pre><code>    &lt;Button Name="Dresses" MouseEnter="onMouseEnter" MouseLeave="onMouseLeave" Content="Dresses" Grid.Row="2" Height="25" Width="85" VerticalAlignment="Center" Grid.Column="5"  FontFamily="Tahoma" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" Cursor="Hand" ClickMode="Hover"&gt;
          &lt;Button.Background&gt;
              &lt;LinearGradientBrush&gt;
                  &lt;GradientStop Color="Yellow" Offset="0" /&gt;
                  &lt;GradientStop Color="Green" Offset="1" /&gt;
              &lt;/LinearGradientBrush&gt;
          &lt;/Button.Background&gt;
      &lt;/Button&gt;
  </code></pre>
  
  <p>C# Code: </p>
  
  <pre><code>    private void OnButtonClickDresses(object sender, RoutedEventArgs e)
      {
              //Code for delay
  
              //Code which should run only if mouse on button after 5 seconds
  
      }
  </code></pre>
  
  <p>PS: I am a beginner in WPF and C#. So if you can post a minimum working example I'd be actually very grateful.</p>