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

RadTabItem visibility bug ?

10 Answers 275 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
didier
Top achievements
Rank 1
didier asked on 22 Jun 2011, 05:10 PM
Hi,
I have set the visibility attribute to a binding value, but when the view is loaded or when the view model is loaded the first content of the rabtabitem content (<telerik:RadTabItem.Content> ) still be visible (the header is hide).
If I hide an another one, it's work fine.
do you have a work around for this ?

My xaml code: 
 <telerik:RadTabItem Height="Auto" x:Name="RibTab"  Visibility="{Binding IsCompteAuthorizedForRead, Source={StaticResource banqueSocieteViewModel}}"  > 

Best regards.
D.Collin

10 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 27 Jun 2011, 04:18 PM
Hello didier,

We tried to reproduce this but we did not manage. Could you please check out our test project and let us know if we have missed something? We also wondered what is the exact version of RadControls that you use. Thank you in advance for your cooperation.

Regards,
Petar Mladenov
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
0
didier
Top achievements
Rank 1
answered on 27 Jun 2011, 05:15 PM
Hi Petar,
thanks for your answer.
I use the version 2010.3.1110.1040 of the component.
I have made some changes in your project to show my difficuties, you will see in the attached file the xaml code and the code behind of the mainpage (i cant sent to you the updated project due to your file limitation policy).
On tab item "a", you'll see a blue rectangle, on tab item "b", you'll see a red rectangle.
if tab item "a" have a visibilty attribute set to collapsed, you'll see that the header "tab item a" is hidden but not the content and the blue rectangle is still visible (see telerik3.png)... 

Best regards
D.Collin
0
Petar Mladenov
Telerik team
answered on 30 Jun 2011, 02:23 PM
Hello Didier,

This issue could be easily fixed with the RadTabControl from Q2 2011 with setting the IsDefaultitemSelected property to false. The problem actually comes from the fact that the first RadTabItem is selected by default.
Unfortunately, this property does not exist in the Q3 2010 nor you can set the IsSelected = false in order to resolve this.


Kind regards,
Petar Mladenov
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
0
Sjors
Top achievements
Rank 1
answered on 17 Feb 2012, 04:42 PM
Hi, 

I'm also facing a problem regarding this issue.
The problem is that when you hide a tab, the content "pane" remains visible because the hidden tab apparently stays selected. 
Your solution with setting the isdefaultselected to false does not work for me.

I have a tabcontrol and depending on an external selection mode tab items are shown or hidden

Mode A
-  1,2,3 are shown, the rest is hidden
Mode B
- 2, 4, 5 are shown, the rest is hidden 
 
I would like the behaviour to be that hidden tabs can not be "selected" and the first available tab will be selected instead when hiding a selected tab. Is this possible?

For now I've fixed it like this, but it does not feel necessary

var tabControl = (RadTabControl)_view.FindName("NameXyz");
var tabItems = tabControl.Items.Cast<RadTabItem>().ToList();
var firstVisible = tabItems.FirstOrDefault(t => t.Visibility == Visibility.Visible);
if (firstVisible != null && tabItems[tabControl.SelectedIndex].Visibility == Visibility.Collapsed)
            {
                tabControl.SelectedIndex = tabItems.IndexOf(firstVisible);
            }
0
Petar Mladenov
Telerik team
answered on 22 Feb 2012, 02:08 PM
Hello Sjors,

 Your workaround is correct and we think that using the SelectedIndex is a correct way to go in this scenario.
We can also suggest you to use databinding and ViewModel. Instead of hiding / showing an items, you can remove/add the corresponding ViewModels. If using similar approach you can take advantage of the SelectedItemRemoveBehavior property and set it to SelectFirst, SelectLast, SelectNext, SelectPrevious or SelectNone (supposing the current is the removed one).

Regards,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
ss
Top achievements
Rank 1
answered on 29 Aug 2012, 07:45 AM
Hi telerik,

i have a one issue with using of RadTabItem.

i am setting the IsHitTestVisible is false to TadTabItem.so it wont alow me to select the tabitem.its fine

but my RadTabItem.header part  i  have one checkbox.

i dont want user to select the tabitem so only i am making the ishittestviewsible as flase.but i need to allow the user to check or uncheck  the checkbox which is located the radtabitem.header section.

advance tanx.

0
Petar Mladenov
Telerik team
answered on 30 Aug 2012, 07:18 AM
Hi SS,

 If you need to use the CheckBoxes in the Header, you cannot use IsHitTestVisible = False. In order to prevent a selection, you can take advantage of the PreviewSelectionChanged event and set e.Handled = true.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ss
Top achievements
Rank 1
answered on 31 Aug 2012, 06:02 AM
Hi Petar,

tanx for ur quick rly.the preventselection event wont be work in my case.y bcoz that wont alow me to select any tabitem .but my case i dont want selection only in the tabitem whihc is having checkbox in the header.

please try to give the solution in that way.

adnavce tax
0
Petar Mladenov
Telerik team
answered on 04 Sep 2012, 12:13 PM
Hello SS,

 Please take a look at the attached project. It shows RadTabControl with 5 RadTabItems - 2 with CheckBoxes and 3 with simple strings in the Header:

<telerik:RadTabControl PreviewSelectionChanged="RadTabControl_PreviewSelectionChanged">
 
        <telerik:RadTabItem>
            <telerik:RadTabItem.Header>
                <StackPanel>
                    <CheckBox />
                    <TextBlock Text="Item A" />
                </StackPanel>
            </telerik:RadTabItem.Header>
        </telerik:RadTabItem>
 
        <telerik:RadTabItem>
            <telerik:RadTabItem.Header>
                <StackPanel>
                    <CheckBox />
                    <TextBlock Text="Item A" />
                </StackPanel>
            </telerik:RadTabItem.Header>
        </telerik:RadTabItem>
 
        <telerik:RadTabItem Header="Item C" />
        <telerik:RadTabItem Header="Item D" />
        <telerik:RadTabItem Header="Item E" />
 
    </telerik:RadTabControl>
In the PreviewSelectionChanged event we check whether the item that is about to be selected is from type A ( with CheckBox) or type B (without CheckBox):
private void RadTabControl_PreviewSelectionChanged(object sender, Telerik.Windows.Controls.RadSelectionChangedEventArgs e)
        {
            if ((e.AddedItems[0] as RadTabItem).Header is StackPanel)
            {
                 e.Handled = true;
            }
        }
However, this check could be implemented in many different ways.
Please let us know if this helps you proceed further.

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ss
Top achievements
Rank 1
answered on 05 Sep 2012, 01:28 PM
hi Petar ,

i think some where i missed somehting so only its not worked when i tried.now its working awesom.

tan q

Tags
TabControl
Asked by
didier
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
didier
Top achievements
Rank 1
Sjors
Top achievements
Rank 1
ss
Top achievements
Rank 1
Share this question
or