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

  • SEARCH
  • Home
  • 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 471809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:01:24+00:00 2026-05-13T00:01:24+00:00

i have a tab control with 2 tabs. the content of each tab is

  • 0

i have a tab control with 2 tabs. the content of each tab is binded to a ListCollectionView and the data template has a grid showing the items. The problem is that if you click on any of the columns to sort, if I select the other tab and return to the first tab the sorting is cleared. Is it a known bug?

here is the code:

<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="Window1" Height="538" Width="1223">
<Window.Resources>
    <DataTemplate x:Key="TestTemplate">
        <toolkit:DataGrid ItemsSource="{Binding}" AutoGenerateColumns="false" IsReadOnly="True" >
            <toolkit:DataGrid.Columns>
                <toolkit:DataGridTextColumn Binding="{Binding IntVal}" Header="Number"></toolkit:DataGridTextColumn>
                <toolkit:DataGridTextColumn Binding="{Binding StringVal}" Header="String"></toolkit:DataGridTextColumn>
            </toolkit:DataGrid.Columns>
        </toolkit:DataGrid>
    </DataTemplate>
</Window.Resources>
<Grid>
    <TabControl>
        <TabItem Header="tab1" ContentTemplate="{StaticResource TestTemplate}" x:Name="a" Content="{Binding}"/>
        <TabItem Header="tab2" ContentTemplate="{StaticResource TestTemplate}" x:Name="b" Content="{Binding}"/>
    </TabControl>
</Grid>

code behid:

public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();

        List<test> intt = new List<test> 
        {
            new test { IntVal = 5, StringVal = "abc" }, 
            new test { IntVal = 12, StringVal = "cc" }, 
            new test { IntVal = 2, StringVal = "sdgc" }, 
            new test{IntVal=64,StringVal="df"},
            new test{IntVal=1234,StringVal="werw"}, 
            new test{IntVal=14,StringVal="sdvvd"}, 
            new test{IntVal=136,StringVal="aasr"} 
        };

        List<test> intt2 = new List<test> 
        {
            new test { IntVal = 5, StringVal = "abc" }, 
            new test { IntVal = 12, StringVal = "cc" }, 
            new test { IntVal = 2, StringVal = "sdgc" }, 
            new test{IntVal=64,StringVal="df"},
            new test{IntVal=1234,StringVal="werw"}, 
            new test{IntVal=14,StringVal="sdvvd"}, 
            new test{IntVal=136,StringVal="aasr"} 
        };

        this.a.DataContext = new ListCollectionView(intt);
        this.b.DataContext = new ListCollectionView(intt2);
    }

    public class test
    {
        public int IntVal { get; set; }
        public string StringVal { get; set; }
    }
}
  • 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-13T00:01:24+00:00Added an answer on May 13, 2026 at 12:01 am

    I think that the TabControl destroy and recreate its child every time you change the selected tab. That would explain why the sort is not kept.

    You can check out this discussion on the WPF Disciples Google Group to have some infos about how to fix that problem.

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

Sidebar

Related Questions

I have a tab control in my WPF application with multiple tabs. Each tab
Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I have a jQueryUI Tabs control on a web page. Each tab contains one
Problem I have Telerik TabControl and each tab content is a partial view. Everything
I have a tab content template set to my tab control: <TabControl SelectedIndex=0 ItemsSource={Binding
Beginner. I have a tab control that has content loaded dynamically via links. These
I have a Tab Control that contains a ListView, there are three Tabs, each
I have a tab control bound to an observablecollection for dynamic tabs as follows:
I am using Ajax tab container control with 3 tabs. I have placed a
I have a tab contol with two tabs. Each one containing listviews. When the

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.