want to make scrollable tabs for a tabcontrol

后端 未结 6 837
故里飘歌
故里飘歌 2020-12-05 14:22

Say I have a tab control, and I have over 50 tabs, where there is no enough space to hold so many tabs, how make these tabs scrollable?

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 14:49

    Override the TabControl ControlTemplate and add a ScrollViewer around the TabPanel like this sample:

    
        
            
                
                    
                        
                            
                        
                        
                    
                
            
            TabItem1 Content
            TabItem2 Content
            TabItem3 Content
            TabItem4 Content
            TabItem5 Content
            TabItem6 Content
            TabItem7 Content
            TabItem8 Content
            TabItem9 Content
            TabItem10 Content
        
    
    

    which gives this result:

    TabControlScroll

提交回复
热议问题