TabControl's TabItems sharing same content… Do Not Want

后端 未结 3 609
走了就别回头了
走了就别回头了 2021-01-04 12:07

The following example xaml causes each tab item to share the same TextBox. It makes sense, on some level I guess... but it\'s unexpected behavior, and almost feels like a bu

3条回答
  •  萌比男神i
    2021-01-04 12:49

    It will work if you define a usercontrol that has the tab content in it. I created the following usercontrol:

    
        
            
        
    
    

    Then I modified my window xaml to be this:

    
        
            
                
                    
                
                
                    
                
            
        
    
    

    This may not be exactly what you are wanting, but at least the layout of each tab is only defined in one place and you can then assign a datacontext to each usercontrol to show the values for each of your tabs.

提交回复
热议问题