它背后的文档不多,但这是在项目模板中绑定到图像源的方式:
<pivot:PivotViewerItemTemplate x:Key="smallTemplate" MaxWidth="300">
<pivot:PivotViewerMultiScaleSubImageHost VerticalAlignment="Top" CollectionSource="{Binding [VisualCollectionSource][0] }" ImageId="{Binding [VisualImageId][0]}"/>
</pivot:PivotViewerItemTemplate>
<pivot:PivotViewerItemTemplate x:Key="largeTemplate">
<Grid Width="900" Height="1000" Background="LightGray">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<pivot:PivotViewerMultiScaleSubImageHost CollectionSource="{Binding [VisualCollectionSource][0] }" ImageId="{Binding [VisualImageId][0]}"/>
<Grid Margin="20" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding [Name][0]}" FontSize="28" TextWrapping="Wrap"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding [Description][0]}" FontSize="20" TextWrapping="Wrap" Margin="0,20, 0, 0"/>
<StackPanel Orientation="Vertical" Margin="20,20,20,0" Grid.Column="1" Width="300">
<TextBlock Text="Speakers" FontSize="24"/>
<ListBox ItemsSource="{Binding [Speakers]}" FontSize="22"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
</pivot:PivotViewerItemTemplate>
请注意,您可能只需要上面的“smallTemplate”,除非您在交易卡中添加一些花哨的东西。您需要在后面的代码中设置模板:
pv.ItemTemplates = new PivotViewerItemTemplateCollection()
{
(PivotViewerItemTemplate) Resources["smallTemplate"],
(PivotViewerItemTemplate) Resources["largeTemplate"]
};