//這是用戶控件的代碼如何在MVVM模型中管理tile usercontrols(具有listbox綁定)?
<ListBox Name="OvernightAverageListBox" ItemsSource="{Binding Path=OvernightAverageCollections}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Name="items" Background="{Binding BackColor}" Height="200" Width="200">
<TextBlock Height="46" HorizontalAlignment="Left" Margin="26,10,0,0" Name="currentRate" Text="{Binding Current_rate}" VerticalAlignment="Top" FontSize="36" />
<TextBlock Height="22" HorizontalAlignment="Left" Margin="26,20,0,0" Name="rate_difference" Text="{Binding RateChange_Value}" VerticalAlignment="Top" FontSize="20" />
<TextBlock Height="30" HorizontalAlignment="Left" Margin="26,30,0,0" Name="productName" Text="{Binding Product_name}" VerticalAlignment="Top" FontSize="24" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
//在視圖
<controls:PanoramaItem Header="Overnight Average" Tap="RateTile_Tap">
<Grid x:Name="overnightAverage">
<views:OvernightAverageTileControl x:Name="eventsView"> </views:OvernightAverageTileControl>
</Grid>
</controls:PanoramaItem>
</ListBox>
這是綁定代碼現在acoording我的代碼的瓷磚來了垂直意味着每個瓦片在一個連續服用。 但我希望它們來水平和垂直意味着每行中兩個瓷磚。 plz分享你的建議我是新的xaml設計。
第一張圖片顯示了我得到的掃管笏。
第二個圖像是我想要的笏。
謝謝:)
如果您需要控制列的數量,網格仍然是更好的解決方案,正如您的問題所暗示的那樣。 – Clemens