Terminador Terminador - 1 month ago 9
C# Question

Double-click event on WPF Window border

Is there any event which fires on double-click event on WPF Window border?

How I can catch it?

Thanks!

Answer

Here is one way.. Just set your Window.WindowStyle to "None" and create your down window border:

<Grid>
    <Border 
        BorderBrush="Silver"  
        BorderThickness="10" 
        Name="border1" 
        MouseLeftButtonDown="border1_MouseLeftButtonDown" />
</Grid>

In code behind:

private void border1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    if (e.ClickCount == 2)
       MessageBox.Show("Double Click");
}
Comments