布局控件不知道选哪个好
我要在一个窗口中显示2个image控件,image大小一样并且上下紧凑的放在一起并铺满窗口,我想要的效果是随着窗口放大缩小,2个image也跟着同步放大缩小,并且紧密相连不会互相覆盖。
研究半天,也不知道用哪个控件能够实现,具体怎么布局。
------解决方案--------------------两个grid解决问题
每一个grid外家一个
<Canvas SizeChanged="Canvas_SizeChanged" Grid.Row="0" >
<Grid Name="grid" Grid.Row="0"
<image/>
</Grid>
</Canvas>
<Canvas SizeChanged="Canvas1_SizeChanged" Grid.Row="1" >
<Grid Name="grid1"
<image/>
</Grid>
</Canvas>
private void Canvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
Canvas can = (Canvas)sender;
grid.Width = can.ActualWidth;
grid.Height = can.ActualHeight;
}
private void Canvas1_SizeChanged(object sender, SizeChangedEventArgs e)
{
Canvas can = (Canvas)sender;
grid1.Width = can.ActualWidth;
grid1.Height = can.ActualHeight;
}