Draw Diagonal Line in WPF Grid

后端 未结 2 1964
暗喜
暗喜 2021-01-04 20:15

I think I am trying to do something relatively simple in WPF, but can\'t for the life of me figure out how; and think I am probably on the verge of overcomplicating it.

2条回答
  •  心在旅途
    2021-01-04 20:40

    You could use a Path with Stretch=Fill. For the top right cell in your example, you would use:

    
        
            
        
    
    

    The "Fill" stretch makes the Path stretch to fill its parent, which gives the impression that the coordinates of the LineGeometry are relative (X=0,Y=0 is top left, X=1,Y=1 is bottom right).

提交回复
热议问题