ViewBox内的拉伸控件

时间:2015-02-27 14:30:45

标签: c# wpf windows-store-apps viewbox

我使用ViewBox控件在winstore应用程序中扩展我的表单。我需要ViewBox中的拉伸控件,但常见的是Horizo​​ntalAlignment ="拉伸"不起作用

这是我的代码:

    <Viewbox Margin="20" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Stretch">
       <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top" >
...

结果是:

enter image description here

ViewBox是灰色矩形,选中了网格(蓝色矩形), TextBoxes没有设置宽度。

你能告诉我,如何解决这个问题?我不想明确设置宽度。

1 个答案:

答案 0 :(得分:0)

尝试将Stretch属性设置为Fillmsdn):

<Viewbox Margin="20" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Stretch" 
           Stretch="Fill">
      <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
相关问题