问题
I have this code:
<ListView Margin="0,10,0,0">
<!--Orientation="Horizontal"-->
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.Items>
<AppBarButton Icon="Download"
IsCompact="False"
Label="Stáhnout test"
HorizontalAlignment="Center"></AppBarButton>
<AppBarButton Icon="Play"
IsCompact="False"
Label="Spustit test"
HorizontalAlignment="Center"></AppBarButton>
<AppBarButton Icon="Attach"
Grid.Column="4"
IsCompact="False"
Label="Otevřít přílohu testu"
HorizontalAlignment="Center"></AppBarButton>
<AppBarButton Icon="ShowResults"
IsCompact="False"
Label="Výsledky"
HorizontalAlignment="Center"></AppBarButton>
<AppBarButton Icon="Delete"
IsCompact="False"
Label="Smazat cache"
HorizontalAlignment="Center"></AppBarButton>
</ListView.Items>
</ListView>
... and it works fine during runtime. When there is not enough horizontal space, some app bar buttons are rendered on the next line (the content of listview is wrapped), which is what I want. I found this solution here: Windows 8 WrapPanel .
The problem is that the designer (VS and also Blend) do not show the content of the lsitview at all. If I comment out the ListView.ItemsPanel section, the designer is back in the game.
Is there a way how to overcome this issue?
回答1:
This is a known problem with the designer and is being investigated for a fix in future versions.
If you are targeting Windows 8.1 then using an ItemsWrapGrid instead of a WrapGrid is recommended. The ItemsWrapGrid will show up correctly both in the designer and at runtime.
--Rob
来源:https://stackoverflow.com/questions/25993352/the-content-of-a-listview-with-itemspanel-modified-is-not-shown-in-designer-vs