我创建了一个带有平铺数据模板的列表框。我现在想弄清楚的是,当鼠标悬停或选定事件发生时,如何正确地将缩放效果应用于每个列表框项,并让它在换行面板中正确呈现。我目前已将动画添加到 ListBoxItemTemplate 的视觉状态中。
一些想法:当动画被调用时,包装面板中的瓷砖不要重新定位以允许正确查看缩放的项目。我想让包裹面板中的项目重新定位,以允许缩放的项目可见。
另外我注意到缩放时的项目超出了包裹面板的边界,有没有办法在缩放时将项目限制在包裹面板的可视区域?
搜索视图中使用的代码
<Grid x:Name="LayoutRoot">
<ListBox x:Name="ResultListBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{x:Null}"
BorderThickness="0"
HorizontalContentAlignment="Stretch"
ItemContainerStyle="{StaticResource TileListBoxItemStyle}"
ItemsPanel="{StaticResource ResultsItemsControlPanelTemplate}"
ItemsSource="{Binding SearchResults[0].Results}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<formatter:TypeTemplateSelector Content="{Binding}" HorizontalContentAlignment="Stretch" Margin="2.5">
<!-- Person Template -->
<formatter:TypeTemplateSelector.PersonTemplate>
<DataTemplate>
<qr:ucTilePerson />
</DataTemplate>
</formatter:TypeTemplateSelector.PersonTemplate>
<!-- Incident Template -->
<formatter:TypeTemplateSelector.IncidentTemplate>
<DataTemplate>
<qr:ucTileIncident />
</DataTemplate>
</formatter:TypeTemplateSelector.IncidentTemplate>
</formatter:TypeTemplateSelector>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
ResultsItemsControlPanelTemplate 在 app.xaml 中定义为
<ItemsPanelTemplate x:Key="ResultsItemsControlPanelTemplate">
<toolkit:WrapPanel x:Name="wrapTile"/>
</ItemsPanelTemplate>
我将不胜感激任何关于在哪里看的建议提前谢谢
当前结果的图像