1
ItemsControl中的WrapGrid將第一項的寬度作爲所有子項的默認寬度。是否有任何解決方法根據每個單獨項目的內容來擴展項目寬度? 這是我的XAML。ItemsControl中的項目佔用第一項的寬度
<Grid Grid.Row="2">
<ItemsControl Grid.Column="1" ItemsSource="{x:Bind articleTags}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#E1E1E1" HorizontalAlignment="Stretch" Background="#E1E1E1" Margin="4,4,0,0">
<TextBlock Text="{Binding NAME}" Margin="6,0,6,0"/>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
在第二圖像的「通訊」項目沒有被充分,因爲它需要的第一個項目的寬度顯示。
如何解決這個問題?
我用itemsstackpanel使用自定義的包裝網格面板...物品超出屏幕.. 。如果超過屏幕尺寸,我希望物品被包裝到下一行。 – Razor
https://www.dropbox.com/s/w4e0ayxblnl6dzb/Capture1.PNG?dl=0 – Razor
感謝您的幫助! – Razor