Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6093853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:36:31+00:00 2026-05-23T12:36:31+00:00

I have a border that contains a TabControl in a HeaderedContentControl: <Border Grid.Column=1 Style={StaticResource

  • 0

I have a border that contains a TabControl in a HeaderedContentControl:

<Border Grid.Column="1" 
    Style="{StaticResource MainBorderStyle}">
    <HeaderedContentControl 
              Content="{Binding Path=Workspaces}"
              ContentTemplate="{StaticResource WorkspacesTemplate}"
              Header="Decision Workspaces"
              Style="{StaticResource MainHCCStyle}"/>
</Border>

The TabControl is defined in a static resource:

<DataTemplate x:Key="ClosableTabItemTemplate">
    <DockPanel Width="120" ToolTip="{Binding Path=DisplayName, Mode=OneTime}">
        <Button 
    Command="{Binding Path=CloseCommand}"
    Content="X"
    Cursor="Hand"
    DockPanel.Dock="Right"
    Focusable="False"
    FontFamily="Courier" 
    FontSize="9"
    FontWeight="Bold"  
    Margin="0,1,0,0"
    Padding="0"
    VerticalContentAlignment="Bottom"
    Width="16" Height="16" 
    />
    <ContentPresenter 
        Content="{Binding Path=DisplayName, Mode=OneTime}"
        VerticalAlignment="Center" 
    />
    </DockPanel>
</DataTemplate>

<!--
This template explains how to render the 'Workspace' content area in the main window.
-->
<DataTemplate x:Key="WorkspacesTemplate">
    <TabControl 
  IsSynchronizedWithCurrentItem="True" 
  ItemsSource="{Binding}" 
  ItemTemplate="{StaticResource ClosableTabItemTemplate}"
  Margin="4"
  />
</DataTemplate>

The Workspaces property which is bound to the HeaderedContentControl’s Content property, has a collection of UserControls, which are rendered in the tabs. This all works fine.

The problem is that when i select a row in a grid in one of the UserControls, switch to a different tab, and then return, the selected row is reset. The same happens if a RowDetails is open – when I switch away and back to the tab, it is collapsed.

Any way around this?

Edit: After looking at the proposed solutions for the TabControl behaviour, I’m wandering if I might ditch it altogether. Any ideas for a UI that will allow me to keep several relatively complex UserControls and switch between them, not loosing the visuals in the process?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:36:32+00:00Added an answer on May 23, 2026 at 12:36 pm

    This is a common problem with the TabControl. Since it only displays the content of the selected tab. If your tab items are not visuals themselves and are presented with a DataTemplate, then the controls will be created and released as you switch tabs.

    There are two solutions to this problem here and here, which attempt to retain the visuals for each tab.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control that contains a border somewhere in it. I am
Basically I have a DataTemplate that contains Border, StackPanel and stuff, and later I
I have a border element with rounded corners containing a 3x3 grid. The corners
I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
I have a listbox with a style that has rounded corners. I'd like to
I have a that contains two nested div's. One of the nested div's contains
I have a Winforms dialog that contains among other controls a TextBox that allows
Let's consider we have QWidget that contains QTableWidget (only). So we want to resize
We have a form that contains various elements and a datagrid. When the list
I have a simple page that contains an iframe. The iframe contains a page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.