We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to prevent tabs from getting realigned when in Multiline mode

 

KeepSelectedTabInFrontRow was added in version 1.6.1.0 to address this issue. For earlier versions, please derive from our base TabControlExt class and do the following. This code will not move the selected tab to the front row when in Multiline mode:

[C#] // Custom tab control will prevent tab realignment in Multiline mode.

public class MyTabControlExt : TabControlExt {

// Plugin the custom MyMultilineTabPanelRenderer class.

protected override void RendererChanged(TabPanelRenderer rendererNew) {

    if(rendererNew == null && this.Multiline) {

        rendererNew = new MyMultilineTabPanelRenderer(this);

    }

base.RendererChanged(rendererNew);

} }

// Custom MyMultilineTabPanelRenderer to prevent tab realignment.

public class MyMultilineTabPanelRenderer : MultilineTabPanelRenderer {

public MyMultilineTabPanelRenderer(ITabControl parent) : base(parent) { }

protected override void ValidateSelectedTabsPosition() {

// Don’t call the base class method which will try to move the selected tab

// to the front row.

} }

[VB.NET] 'Custom tab control will prevent tab realignment in Multiline mode.

Public Class MyTabControlExt Inherits TabControlExt

' Plugin the custom MyMultilineTabPanelRenderer class.

Protected Overrides Sub RendererChanged(ByVal rendererNew As TabPanelRenderer)

    If rendererNew Is Nothing AndAlso Me.Multiline Then

        rendererNew = New MyMultilineTabPanelRenderer(Me)

    End If

MyBase.RendererChanged(rendererNew)

End Sub

'RendererChanged End Class ’MyTabControlExt 

'Custom MyMultilineTabPanelRenderer to prevent tab realignment.

Public Class MyMultilineTabPanelRenderer Inherits MultilineTabPanelRenderer

Public Sub New(ByVal parent As ITabControl)

    MyBase.New(parent)

End Sub

Protected Overrides Sub ValidateSelectedTabsPosition() End Sub

'ValidateSelectedTabsPosition

End Class

'MyMultilineTabPanelRenderer

'Don’t call the base class method which will try to move the selected tab

Article ID: Published Date: Last Revised Date: Platform: Control:
1182 04/30/2011 07/10/2014 WinForms TabControlAdv
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon