1
我使用Pivot Excel工具生成了cxml文件和圖像集合。然後我創建了一個帶有PivotViewer控件的表單,並將其指向我的收藏文件。該頁面打開,顯示我的所有過濾器只有一個空白的表面,沒有瓷磚。我嘗試了幾個瀏覽器無濟於事。以下是我正在使用的XAML。從其他帖子我也調整了height
/width
/maxheight
/maxwidth
,沒有任何幫助。任何幫助表示讚賞!Silverlight 5 PivotViewer控件不顯示cxml中的圖像切片
<UserControl x:Class="Pivot.MainPage"
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:pv="clr-namespace:System.Windows.Controls.Pivot;assembly=System.Windows.Controls.Pivot"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<pv:PivotViewer Name="pvViewer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
這裏是代碼隱藏
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
pvViewer.Loaded += new RoutedEventHandler(pvViewer_Loaded);
}
readonly string CXML_PATH = @"C:\Users\joshh\Documents\R&D\Pivot\PDP.cxml";
private CxmlCollectionSource _cxml;
void pvViewer_Loaded(object sender, RoutedEventArgs e)
{
_cxml = new CxmlCollectionSource(new Uri(CXML_PATH, UriKind.Absolute));
_cxml.StateChanged += new EventHandler<CxmlCollectionStateChangedEventArgs>(_cxml_StateChanged);
}
void _cxml_StateChanged(object sender, CxmlCollectionStateChangedEventArgs e)
{
if (e.NewState == CxmlCollectionState.Loaded)
{
pvViewer.PivotProperties = _cxml.ItemProperties.ToList();
pvViewer.ItemTemplates = _cxml.ItemTemplates;
pvViewer.ItemsSource = _cxml.Items;
}
}
}