2011-12-13 47 views
0

設置我有這樣的代碼:WP7最大寬度文本框和位置從右

<controls:PivotItem Header="Hledat"> 
    <Canvas Margin="0"> 
     <TextBox Name="SearchTxb" Height="72" Text="" VerticalAlignment="Top" HorizontalAlignment="Right" /> 
     <Button Name="SearchBtn" Margin="0,74,100,0" Width="200" Height="72" Click="SearchBtn_Click" HorizontalAlignment="Right" VerticalAlignment="Top">Hledat</Button> 
    </Canvas> 
</controls:PivotItem> 

,我要支持人像和風景。這應該是搜索的樞紐。我想要文本框將寬度更改爲手機屏幕的全尺寸,並且我想將按鈕設置爲f.e. 20從右側。我應該添加什麼代碼?謝謝

回答

0
<controls:PivotItem Header="Hledat"> 
    <Grid Margin="0"> 
     <Grid.ColumnDefinition> 
      <ColumnDefinition Width="*" /> 
      <ColumnDefinition Width="Auto" /> 
     </Grid.ColumnDefinition> 
     <TextBox Grid.Column="0" Name="SearchTxb" Height="72" Text="" VerticalAlignment="Top" HorizontalAlignment="Stretch" /> 
     <Button Grid.Column="1" Name="SearchBtn" Margin="0,74,100,0" Width="200" Height="72" Click="SearchBtn_Click" HorizontalAlignment="Right" VerticalAlignment="Top">Hledat</Button> 
    </Grid> 
</controls:PivotItem> 
+0

與Grid.ColumnSpan =「2」在文本框中它正是我一直在尋找,謝謝 –