1

我已经使用 Pivot Excel 工具生成了一个 cxml 文件和图像集合。然后,我创建了一个包含 PivotViewer 控件的表单,并将其指向我的集合文件。页面打开,显示我所有的过滤器,只有一个空白表面,没有瓷砖。我已经在几个浏览器中尝试过,但都无济于事。下面是我正在使用的 XAML。从这里的其他帖子中,我也调整了height/ width/ maxheight/ maxwidth,但这些都没有帮助。任何帮助表示赞赏!

    <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;
        }
    }
}
4

1 回答 1

0

显然 Chrome 16 不会呈现 PivotViewer。将我的默认浏览器切换到 IE,一切都很好。

于 2012-01-11T02:24:10.297 回答