.NET
Microsoft Technologies based on the .NET software framework.
3,922 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Our application has a RibbonBar containing several tabs. In it we have disabled the ability to shrink the ribbon bar by double clicking on the tab headers by intercepting the PreviewMouseDoubleClick event and marking it as handled.
This works fine for a couble click.
However we have now discovered that a triple click will also hide the ribbon bar. The double click handler is called but has no effect.
Has anybody else seen this behaviour? How can we stop it?
Try something like this:
[DllImport( "user32" )]
public static extern int GetDoubleClickTime( );
int ts = 0;
private void Ribbon_PreviewMouseDoubleClick( object sender, MouseButtonEventArgs e )
{
e.Handled = true;
ts = e.Timestamp;
}
private void Ribbon_PreviewMouseDown( object sender, MouseButtonEventArgs e )
{
e.Handled = e.Timestamp - ts <= GetDoubleClickTime( );
ts = e.Timestamp;
}
Add the PreviewMouseDown in XAML.