WPF - Margin in percentage

后端 未结 2 1847
忘了有多久
忘了有多久 2021-01-05 05:53

I have just started using WPF. I\'m getting my head around styling system since. I come from a CSS background and I would like to set margin in percentage.

          


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-05 06:41

    Here's how you implement 20% left and right margins in WPF:

    
       
          
          
          
       
       
    
    

    This may seem ridiculously verbose if what you're trying to do is re-implement a simple CSS layout in WPF, but that's because implementing simple CSS layouts is really not the problem space WPF is designed around.

提交回复
热议问题