Silverlight MouseLeave shows inconsistent behavior

So my problem is that the MouseLeave event is fired only when the cursor moves at a certain speed. Below is a Thumb with a border. Press the thumb and hold the mouse button. Slowly move overseas = no event, quickly go overseas = event.

<Grid x:Name="LayoutRoot" Background="White">
    <Border BorderBrush="Black" BorderThickness="3" Width="200" Height="100"
            MouseLeave="Border_MouseLeave">
            <Thumb  />
    </Border>
</Grid>


private void Border_MouseLeave(object sender, MouseEventArgs e)
{
    MessageBox.Show("Border_MouseLeave");
}

Is this a mistake in silverlight or am I missing something? Thanx / mike

+3
source share
1 answer

Thanx for announcements, here's an update: This seems to be related to MouseCapture, as Guy suggests. The reason is that I also get the problem using a Button or Rectangle, which captures the mouse in the code.

Grid Thumb Border, , ​​ , .

, .

        <Grid Width="200" Height="100" Background="Transparent" 
              MouseLeave="Border_MouseLeave">                
              <Button  />                
              <Rectangle Width="40" Height="40" Fill="Violet"               
                         HorizontalAlignment="Left" />            
         </Grid>

Rectangle, MouseLeave .

.

0

Source: https://habr.com/ru/post/1782768/


All Articles