Page tree
Skip to end of metadata
Go to start of metadata

您可以在任意的ItemsControl中使用C1Tile,如C1TileListBox或者GridView控件,这里给出在ListBox控件绑定C1FlipTile的标记示例:

XAML

<ListBox ItemsSource="{Binding}" x:Name="listBox" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate> <c1:C1WrapPanel Background="YellowGreen"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="c1:C1TileService.PointerDownAnimation" Value="True"/> </Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<c1:C1FlipTile Height="200" Width="200" Header="{Binding Title}"
Content="{Binding}" Background="DarkGreen" HeaderBackground="#88000000"
HeaderFontSize="18" Command="{Binding TileCommand, ElementName=pageRoot}" HeaderPadding="2" Padding="0" HeaderForeground="White" CommandParameter="{Binding
Content, RelativeSource={RelativeSource Self}}">

<c1:C1Tile.ContentTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Author}" Foreground="White"
VerticalAlignment="Top" Margin="4,2,0,2"/>
<Image Source="{Binding Thumbnail}"
Stretch="UniformToFill" Margin="1, 24, 24, 1"/>
</Grid>
</DataTemplate>
</c1:C1Tile.ContentTemplate>
<c1:C1Tile.AlternateContentTemplate>
<DataTemplate>
<Grid>
<Image Source="{Binding Thumbnail}"
Stretch="UniformToFill"/>
</Grid>
</DataTemplate>
</c1:C1Tile.AlternateContentTemplate>
</c1:C1FlipTile>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

注意注意:如果您在ListBoxVirtualizingStackPanel使用C1Tile控件作为ItemsPanel,为了避免在滚动ListBox时动画效果,你需要将VirtualizingStackPanel.VirtualizationMode设置为Standard

  • No labels