Welcome Guest Search | Active Topics | Sign In | Register

Incorrect width of new tab header for "Shrink" option Options
iTester
Posted: Thursday, June 15, 2017 12:19:49 PM
Rank: Member
Groups: Member

Joined: 5/2/2017
Posts: 25
Hello,
We observed problem with width of new tab headers when Option "Shrink" for the TabItemOverflowStrategy is selected.
When this option set and new page is created using target="_blank" (like

the <a href="http://www.intellectualarchive.com/?link=rules" target="_blank">Manuscript Guidelines</a> )

then width of tab headers becomes unequal. Header of new tab is very short, and headers of old tabs stay as is.

Please see the picture



What is interesting, when user clicks any tab header, the width of all of tab headers become equal again!

Picture

Is it possible to make the width of all of tab headers to be equal at the moment of new tab creation, before clicking?


Thanks!
eo_support
Posted: Tuesday, June 20, 2017 3:56:20 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

We have looked into this issue. The root of the problem is when the new tab item's text/icon updates the tab control did not run layout again. You can make the following change to the WebPage class to force layout when this occurs:

Code: C#
internal class WebPage: DependencyObject
{
    ....

    //The main tab controls
    private EO.Wpf.TabControl m_TabControl;

    ....
    
    //Pass the TabControl to the WebPage
    public WebPage(EO.WebBrowser.WebView webView, EO.Wpf.TabControl tabControl)
    {
        ....

        m_TabControl = tabControl;
    }

    //For the header to run layout again
    private void RelayoutTabHeaders()
    {
        UIElement header = m_TabControl.HeaderElement;
        if (header != null)
        {
            EO.Wpf.Primitives.TabStripPanel panel = GetTabStripPanel(header);
            if (panel != null)
                panel.InvalidateMeasure();
        }
    }

    //Get the TabStripPanel object from the header. This
    //element holds all the tab item headers
    private EO.Wpf.Primitives.TabStripPanel GetTabStripPanel(DependencyObject obj)
    {
        if (obj is EO.Wpf.Primitives.TabStripPanel)
            return (EO.Wpf.Primitives.TabStripPanel)obj;

        int n = System.Windows.Media.VisualTreeHelper.GetChildrenCount(obj);
        for (int i = 0; i < n; i++)
        {
            DependencyObject child = System.Windows.Media.VisualTreeHelper.GetChild(obj, i);
            EO.Wpf.Primitives.TabStripPanel panel = GetTabStripPanel(child);
            if (panel != null)
                return panel;
        }

        return null;
    }

    void m_WebView_FaviconChanged(object sender, EventArgs e)
    {
        ....

        //Force layout on tab headers when Favicon changes
        RelayoutTabHeaders();
    }

    void m_WebView_TitleChanged(object sender, EventArgs e)
    {
        Title = m_WebView.Title;

        //Force layout on tab headers when Title changes
        RelayoutTabHeaders();
    }

    ....
}

The above change will be included in our next build.

Thanks!


iTester
Posted: Wednesday, June 21, 2017 2:23:24 PM
Rank: Member
Groups: Member

Joined: 5/2/2017
Posts: 25
Thank you very much for detailed answer.

When you are planning to release the next build?

Thanks.
eo_support
Posted: Thursday, June 22, 2017 8:06:14 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

The new build should be out late next week. However for this particular issue you do not need to wait for the new build. The changes are 100% in the TabbedBrowser sample project and we have already posted all the changed source code. There are no changes in our product DLLs for this issue.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.