Setting different alignments for listview columns

前端 未结 2 1940
花落未央
花落未央 2021-02-12 11:23

I\'m having trouble drawing a listview with columns that are left or centre aligned. I\'ve looked at a few of solutions that I\'ve found on here or other forums but they either

2条回答
  •  甜味超标
    2021-02-12 11:52

    Although LPL's hint had already saved thousands of headaches, I would go even further and define HorizontalContentAlignment and VerticalContentAlignment to stretch in order to target an expected alignment behaviours on most used table driven controls:

    • ListView column headers and items templates

    • DataGrid column headers and cell templates.

      
      
      
      
      
      
      
      
      
      
          
              
                  
                      
                          
                              
                          
                      
                      
                          
                      
                  
                  
                      
                          
                              
                          
                      
                      
                  
                  
                      
                          
                              
                          
                      
                      
                          
                      
                  
              
          
      
      
          
              
                  
                      
                  
                  
                      
                          
                      
                  
              
              
                  
                      
                          
                      
                  
                  
                      
                          
                      
                  
              
              
                  
                      
                          
                      
                  
                  
                      
                          
                      
                  
              
          
      
      
      
      

    Rembember: you can always define your default styles and other resources at application level so you don't have to define it every view.

    Hope it helps someone else like LPL's hint helped me.

提交回复
热议问题