2015-04-15 134 views
1

我有這個XAML代碼,我希望網格在第2行和第1-3列。
現在的問題是,如果我指定網格邊距,對於不同尺寸的設備看起來不太好,並且如果我沒有指定邊距,則網格將不在移動屏幕中。帶有自動保證金的網格 - Windows Phone 8.1 Silverlight

如何保持利潤率的汽車和電網布局

<Grid Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3"> 
    <Button x:Name="undoButton" 
      Content="undo" 
      Grid.Column="1" Grid.Row="2" 
      HorizontalAlignment="Left" 
      Click="undoButton_Click" Height="70" Width="90" 
      FontSize="16" Background="#FF4B9599" /> 
    <Button x:Name="redoButton" Content="redo" 
      Height="70" 
      Width="90" 
      Grid.Column="2" Grid.Row="2" 
      HorizontalAlignment="Center" 
      Click="redoButton_Click" FontSize="16" 
      Background="#FF4B9599"/> 
    <Button x:Name="clearButton" 
      Content="clear" 
      HorizontalAlignment="Right" 
      Height="70" Width="90" 
      Grid.Column="3" Grid.Row="2" 
      FontSize="16" Background="#FF4B9599" 
      Click="clearButton_Click"/> 
</Grid> 

這裏面的行和列的定義:

<Grid.RowDefinitions> 
    <RowDefinition Height="90" /> 
    <RowDefinition Height="Auto"/> 
    <RowDefinition Height="Auto"/> 
</Grid.RowDefinitions> 
<Grid.ColumnDefinitions> 
    <ColumnDefinition Width="*"/> 
    <ColumnDefinition Width="*"/> 
    <ColumnDefinition Width="*"/> 
    <ColumnDefinition Width="*"/> 
    <ColumnDefinition Width="*"/> 
</Grid.ColumnDefinitions> 

還有,如果我不加保證金

電網

enter image description here

+0

不明白你的問題,你可以更specific.Please包括對預期結果的一些圖紙。 – Joseph

+0

@Joseph請現在檢查屏幕截圖,我希望這是明確的 – Saira

+0

你在網格內還有哪些其他元素? – csharpwinphonexaml

回答

1

從您提供給我們的, 的解決方案是非常簡單

替換此:

<Grid.RowDefinitions> 
    <RowDefinition Height="90" /> 
    <RowDefinition Height="Auto"/> 
    <RowDefinition Height="Auto"/> 
</Grid.RowDefinitions> 

與此:

<Grid.RowDefinitions> 
    <RowDefinition Height="*"/> 
    <RowDefinition Height="*"/> 
    <RowDefinition Height="90" /> 
</Grid.RowDefinitions> 

如果你給我們想要的結果的更多信息,並要放在其他項目第0行和第1行,我們可以給你更具體的幫助。

+0

不,它不起作用。但我很感謝幫助謝謝:) – Saira

+0

現在再次檢查 – csharpwinphonexaml

+0

*,'9 *'和'*'的工作。在我不知道它是如何工作之前,現在我明白了。 – Saira

-1

我不知道問題是什麼,或者它在哪裏,但這個工作

<RowDefinition Height="Auto" MinHeight="80"/> 
<RowDefinition Height="*"/> 
<RowDefinition Height="Auto" MinHeight="70" /> 
相關問題