RadTabItem visibility bug ?

11 posts, 0 answers
  1. didier
    didier avatar
    7 posts
    Member since:
    Nov 2010

    Posted 22 Jun 2011 Link to this post

    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
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 27 Jun 2011 Link to this post

    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
  3. DevCraft banner
  4. didier
    didier avatar
    7 posts
    Member since:
    Nov 2010

    Posted 27 Jun 2011 Link to this post

    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
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Jun 2011 Link to this post

    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
  6. Sjors
    Sjors avatar
    1 posts
    Member since:
    Feb 2012

    Posted 17 Feb 2012 Link to this post

    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);
                }
  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 22 Feb 2012 Link to this post

    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 >>
  8. ss
    ss avatar
    37 posts
    Member since:
    Nov 2010

    Posted 29 Aug 2012 Link to this post

    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.

  9. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Aug 2012 Link to this post

    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.

  10. ss
    ss avatar
    37 posts
    Member since:
    Nov 2010

    Posted 31 Aug 2012 Link to this post

    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
  11. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 Sep 2012 Link to this post

    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.

  12. ss
    ss avatar
    37 posts
    Member since:
    Nov 2010

    Posted 05 Sep 2012 Link to this post

    hi Petar ,

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

    tan q

Back to Top
DevCraft banner