1
我正在使用網格並在我的頁面中。頁面應該像冰塊托盤一樣分區。我怎樣才能在相等的部分分割和使用我的網格?
每個網格列包含一個圖像。
對於分割成3個等份我使用此代碼:
<ListBox SelectionChanged="listBox1_SelectionChanged" HorizontalContentAlignment="Stretch" Height="720" HorizontalAlignment="Left" Margin="1,5,0,0" Name="listBox1" VerticalAlignment="Top">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Center" VerticalAlignment="Top" Margin="3" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Border CornerRadius="6" BorderBrush="Gray" BorderThickness="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="border1">
<toolkit:WrapPanel x:Name="wp">
<Image Source="{Binding ImagePicture}" Margin="0,10,0,0" Height="110" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Margin="0,0,0,5" TextAlignment="Center" Text="{Binding categoryname}" Foreground="Black" FontStyle="Normal" Height="Auto" Width="140" HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
</toolkit:WrapPanel>
</Border>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
現在,當我利用這一點,有時圖像是小我面臨這樣的問題我已示出。
這就是我想:
這是我的問題:
能否請您分享這個問題的解決方案。
http://stackoverflow.com/questions/3565066/how-to-set-grid-images-have-uniform-height-and-width試試這個 – Ayesha
這個答案是針對android – arnp