다양한 버튼 (실제로는 버튼처럼 동작하는 Usercontrols)을 표시하는 데 WrapPanel을 사용하고 싶습니다. 각 WrapPanel 내부에는 항목이있는 ItemsControl이 있습니다. 종종 WrapPanel은 모든 항목을 표시하지 않습니다. 네 개가 있으면 하나 또는 두 개만 보게됩니다. 동작이 일관되지 않습니다.Silverlight WrapPanel이 항목을 일관되게 표시하지 않습니다.
잘못된 것이 있습니까? WrapPanel과 같은 알려진 문제가 있습니까?
<UserControl x:Name="ucCatalogContent" Grid.Row="2">
<local:Catalog_CategoryView />
이는 CategoryView 마크 업입니다 : XAML에 대한
이 우리의 주요 창에서 UserControl을합니다. 여기에는 ItemsControl이 있습니다. ,
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
xmlns:custom="clr-namespace:CustomControlResources;assembly=CustomControlResources"
xmlns:local="clr-namespace:Catalog;assembly=Catalog"
x:Class="Catalog.Category"
>
<UserControl.Resources>
<ItemsPanelTemplate x:Key="CategoryItemPanel">
<toolkit:WrapPanel
VerticalAlignment="Top"
HorizontalAlignment="Stretch"
/>
</ItemsPanelTemplate>
<DataTemplate x:Key="OfferingDT" >
<local:OfferingTile x:Name="offeringTile" />
</DataTemplate>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Style="{StaticResource ContentRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<custom:BlockExpander x:Name="expCategoryExpander"
Title="access [bind me]">
<custom:BlockExpander.BlockExpanderContent>
<ItemsControl x:Name="icServiceOfferingsList"
ItemsPanel="{StaticResource CategoryItemPanel}"
ItemTemplate="{StaticResource OfferingDT}"
>
<local:OfferingTile />
<local:OfferingTile />
<local:OfferingTile />
<local:OfferingTile />
</ItemsControl>
</custom:BlockExpander.BlockExpanderContent>
</custom:BlockExpander>
</Grid>
이 스크린 샷에서
:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
xmlns:local="clr-namespace:Catalog;assembly=Catalog"
x:Class="Catalog.Catalog_CategoryView"
>
<UserControl.Resources>
<DataTemplate x:Key="CategoryDT" >
<local:Category />
</DataTemplate>
</UserControl.Resources>
<ScrollViewer x:Name="scvCatalogCategoryView"
HorizontalScrollBarVisibility="Disabled">
<!-- This is the item that should be bound to the collection of categories -->
<ItemsControl x:Name="icCategories"
ItemTemplate="{StaticResource CategoryDT}"
>
<local:Category x:Name="item1" />
<local:Category x:Name="item2" />
<local:Category x:Name="item3" />
</ItemsControl>
</ScrollViewer>
그리고 이것은 WrapPanel 개별 종류, 사용되어 그 항목은 그들 내부 WrapPanel 기타 된 UserControls 있습니다 각 확장기 머리글 (파란색 삼각형)에 제목이 있어야하고 각 그룹에는 4 개의 항목이 있어야합니다 :
나는 'ScrollViewer'(가로 스크롤 막대를 사용할 수 없음)에 컨트롤을 래핑했기 때문에 그렇게 생각한다. 스크롤 뷰어에는 무한 범위가 있으므로 부모의 너비를 알아야하는 항목이 제대로 작동하지 않을 수 있습니다. – ChrisF
그럴 것 같지 않습니다. 때로는 4 개의 행이 모두 3 행으로 표시되고 다른 행은 아무 행도 표시되지 않거나 1에서 2, 3에서 다른 행이 표시됩니다. 또한 확장기 제목이 표시되지 않습니다. – dex3703