How to restore controls in their correct places same as earlier when we maximize a window?
I am creating a wpf application.It contains a ListBox in which there are 3 buttons that are to be put on extreme right hand side one after another .The problem is that when I maximize that window ,the buttons does not take their correct places as used to be in earlier window i.e. They should be on the extreme right hand side of the form one after another.But now they are shown in the middle of the ListBox..Please guys help me to solve开发者_StackOverflow社区 this problem ASAP..
With no code to go on, I can only assume you're using absolute positioning. That would explain why it only works when your Window is a certain size. If you instead use relative positioning, you can achieve your goals.
There are many ways to do this, and you should read up on WPF layout if you're unfamiliar with it. Here is one example:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ListBox/>
<StackPanel Grid.Column="1">
<Button>One</Button>
<Button>Two</Button>
<Button>Three</Button>
</StackPanel>
</Grid>
精彩评论