I have a igWindows:XamTabControl . The moment the mouse middle button is clicked on the tab it gets closed.Is this the default behavior of tab?Can this be handled.I have written the code to avoid the closing of the tab wherever the mouse middle button is clicked on that tab, but when we try clicking the tab header the tab closes.I thought tab header is a part of the tab control and it should not close when the appropriate code is in place.i have posted the code.Please let me know what is the solution to this problem as it is very urgent.
public void TabCloseEventOnMouseScroll(object sender, MouseButtonEventArgs e) { if ((e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed) || (e.ChangedButton == MouseButton.Left && e.ButtonState == MouseButtonState.Pressed) || (e.ChangedButton == MouseButton.Right && e.ButtonState == MouseButtonState.Pressed)) { e.Handled = true; } } Also if the tab is added dynamically how to achieve the same, because the above mentioed code does not work for dynamically added tab as the event is not getting fired
public void TabCloseEventOnMouseScroll(object sender, MouseButtonEventArgs e)
{
if ((e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed) || (e.ChangedButton ==
(e.ChangedButton ==
MouseButton.Left && e.ButtonState == MouseButtonState.Pressed) || (e.ChangedButton ==
MouseButton.Right && e.ButtonState == MouseButtonState.Pressed)) { e.Handled =
e.Handled =
true; } } Also if the tab is added dynamically how to achieve the same, because the above mentioed code does not work for dynamically added tab as the event is not getting fired
}
Also if the tab is added dynamically how to achieve the same, because the above mentioed code does not work for dynamically added tab as the event is not getting fired
Hello,
I have been looking into your issue and found a way for you to achieve your goal. I suppose that the event you have handled is fired after the command is executed, so I managed to overcome this by handling the PreviewMouseDown event using this style :
<Style TargetType="{x:Type igWindows:TabItemEx}">
<EventSetter Event="PreviewMouseDown" Handler="TabItemEx_PreviewMouseDown" />
</Style>
and its corresponding code :
void TabItemEx_PreviewMouseDown(object sender, MouseButtonEventArgs e)
if (e.ChangedButton == MouseButton.Middle)
e.Handled = true;
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support