2012-06-04 38 views
0

我想在我的xaml代碼中製作一個2x2的矩形。 (我用的windows phone佈局全景控制) 這樣的..我有一個關於窗口手機佈局的問題

○○

○○

我用這個代碼。

   <ListBox.ItemTemplate> 
        <DataTemplate> 
         <StackPanel FlowDirection="LeftToRight" Orientation="Horizontal" Margin="0,0,0,17"> 
          <!--Replace rectangle with image--> 
          <Rectangle Height="100" Width="100" Fill="Orange" Margin="12,0,9,0"/> 
          <StackPanel Width="311"> 
           <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/> 
           <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/> 
          </StackPanel> 
         </StackPanel> 
        </DataTemplate> 
       </ListBox.ItemTemplate> 
      </ListBox> 
     </controls:PanoramaItem>  

但使...

Ø

Ø

Ø

Ø

我該如何解決這個問題? 讓我知道!請! Thanx! :)

+0

如果我正確理解你,你需要在「矩形」中佈置你的物品?所以,嘗試使用WrapPanel http://windowsphonegeek.com/articles/WP7-WrapPanel-in-depth –

回答

0

你的問題是與標籤或?問題並不清楚。 如果我理解正確,這應該可以解決您的問題。

<StackPanel Width="311" Orientation="Horizontal"> 

嘗試一下本作在內的StackPanel

0

它看起來就像你在你的模板使用一個列表框,但名單是爲了走直降。您可以在列表框內執行某些操作,但列表框始終會創建一個直線上下的列表項。

如果你想要一個網格模式,使用網格控件和Grid.RowDefinitions和Grid.ColumnDefinitions來製作正確的模式。

+0

哦,我明白了非常感謝。我會嘗試的!無論如何,謝謝!祝你有美好的一天:) –