TabItem in a separate XAML

后端 未结 4 1773
萌比男神i
萌比男神i 2020-12-01 06:04

Is it possible to put a TabItem into a separate XAML and reference something like this:


     

         


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 06:28

    On the surface this sounds like it would be best solved by a a style and/or template for the TabItem control which you can store in a separate resource file. How much you need to customize the actual TabItem will determine if you can just use a style or if you need a template.

    What you can do is define a named Style for each TabItem in a separate resource file like so, create a MyResources.xaml that looks something like this:

    
        
    
    

    Then in your main App.xaml file you merge in the resource dictionary:

    
        
            
                
            
        
    
    

    Finally in your application you would leverage these Styles by simply doing:

    
    

提交回复
热议问题