Align items in a stack panel?

前端 未结 9 1232
我寻月下人不归
我寻月下人不归 2020-12-04 10:23

I was wondering if I can have 2 controls in a horizontal-oriented StackPanel so that the right item should be docked to the right side of the StackPanel.

I tried the

9条回答
  •  悲哀的现实
    2020-12-04 11:13

    If you are having a problem like the one I had where labels were centered in my vertical stack panel, make sure you use full width controls. Delete the Width property, or put your button in a full-width container that allows internal alignment. WPF is all about using containers to control the layout.

    
        Left
        
            
        
    
    

    Vertical StackPanel with Left Label followed by Right Button

    I hope this helps.

提交回复
热议问题