This is a migrated thread and some comments may be shown as answers.

Possible cross thread issue?

1 Answer 45 Views
Tabstrip (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike Baldini
Top achievements
Rank 1
Mike Baldini asked on 04 May 2010, 08:52 PM
We have a RadTabStrip control that has listboxes and combo boxes located on each TabItem.

The issue we are running in to is populating the BindingSources for each combo box on the RadTabStrip.TabSelected event.

On form load, we have the following code:
        void Form1_Load(object sender, EventArgs e) 
        { 
            PopulateOutTabCombo(); 
            PopulateOutTabList(); 
            this.radTabStrip1.SelectedTab = tabItem2; 
        } 
 
        void PopulateOutTabCombo() 
        { 
            DataItem2Manager dm2 = new DataItem2Manager(); 
            this.outTabComboSource.DataSource = dm2; 
        } 
        void PopulateOutTabList() 
        { 
            DataItem1Manager dm1 = new DataItem1Manager(); 
            this.outTabListSource.DataSource = dm1; 
        } 


The routine that handles the radTabStrip1.SelectedTab event has the following code:
        void radTabStrip1_TabSelected(object sender, Telerik.WinControls.UI.TabEventArgs args) 
        { 
            PopulateInTabCombo(); 
            PopulateInTabList(); 
        } 
 
        void PopulateInTabCombo() 
        { 
            DataItem2Manager dm2 = new DataItem2Manager(); 
            this.inTabComboSource.DataSource = dm2; 
        } 
        void PopulateInTabList() 
        { 
            DataItem1Manager dm1 = new DataItem1Manager(); 
            this.inTabListSource.DataSource = dm1; 
        } 

When the SelectedTab changes to tabItem2 on the form load event, the BindingSource does not get populated with any data, even though the code is being run.

Even more interesting, if you breakpoint the code 'this.inTabComboSource.DataSource = dm2;', you can see that the BindingSource.Count = 0, BUT.... the BindingSource.DataSource property has 10 items in it!

This ONLY happens when you programmatically switch the SelectedTab. If the user clicks on the tab to switch it, it works perfect! Is there some cross thread issues going on that I am not seeing?

After the form loads, if you manually switch the tabs, the BindingSource will be populated, and you will get the items in the combo box and list box.

You can download a copy of my sample solution if you need to reproduce the issue.

Has anyone else run into this problem? If so, have you been able to solve it?

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 10 May 2010, 02:36 PM
Hello Mike Baldini,

Thank you for writing.

The reason nothing is happening lies in the fact that the TabSelected event does not fire initially. This in turn is happening because the initially selected tab is tabItem2. You are attempting to select it and when RadTabStrip sees that you are passing the same tab item as the selected tab item it does nothing.

Please write again if you need further assistance.

Greetings,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Tabstrip (obsolete as of Q2 2010)
Asked by
Mike Baldini
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or