0

我正在使用 Silverlight 5 的新数据透视查看器,但无法在详细信息窗格中获取超链接标题。

 <sdk:PivotViewer Name="pivotView">
    <sdk:PivotViewer.PivotProperties>
        <sdk:PivotViewerStringProperty Id="TitleProperty" DisplayName="Title" Options="CanSearchText" Binding="{Binding Title}" />
        <sdk:PivotViewerDateTimeProperty Id="YearProperty" DisplayName="Year" Options="CanFilter" Binding="{Binding Year}"/>
        <sdk:PivotViewerStringProperty Id="TypeProperty" DisplayName="Type" Options="CanFilter" Binding="{Binding Type}"/>
        <sdk:PivotViewerNumericProperty Id="AvgProperty" DisplayName="Average" Options="CanFilter" Binding="{Binding Avg}"/>
        <sdk:PivotViewerNumericProperty Id="RankProperty" DisplayName="Rank" Options="CanFilter" Binding="{Binding Rank}"/>
        <sdk:PivotViewerNumericProperty Id="EpisodeProperty" DisplayName="Episodes" Options="CanFilter" Binding="{Binding EpisodeCount}"/>
        <sdk:PivotViewerLinkProperty Id="UriProperty" DisplayName="Location"  Binding="{Binding Title}"/>
    </sdk:PivotViewer.PivotProperties>
    <sdk:PivotViewer.ItemTemplates>
        <sdk:PivotViewerItemTemplate>
            <Border Width="200" Height="200" Background="Gray">
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Title}"/>
                    </StackPanel>
                </StackPanel>
            </Border>
        </sdk:PivotViewerItemTemplate>
    </sdk:PivotViewer.ItemTemplates>
</sdk:PivotViewer>
4

2 回答 2

0

我没有Options像其他人一样看到为链接属性设置的属性。

要仅在详细信息窗格中显示它,您需要设置Options=Private

<sdk:PivotViewerLinkProperty Id="UriProperty" DisplayName="Location" Options="Private"  Binding="{Binding Title}"/>

MSDN PivotViewerPropertyOptions 枚举

于 2012-05-03T13:19:59.073 回答
0

我遇到了整个集合无法显示的问题,因为我将 PivotViewerLinkProperty 绑定到字符串字段,而不是 PivotViewerHyperlink 类型的字段。

为了避免更改我的服务定义,我添加了一个转换器(在我的 App.xaml 中注册):

public class DBURLConverter : IValueConverter
{
    public object Convert(object value
        , Type targetType
        , object parameter
        , CultureInfo culture)
    {
        return new PivotViewerHyperlink("URL Title", new Uri(value.ToString()));
    }

    public object ConvertBack(object value
        , Type targetType
        , object parameter
        , CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

然后在绑定到原始 URL 字符串字段时使用转换器:

 <pivot:PivotViewerLinkProperty      
         Id="My URL"    Options="None"
         Binding="{Binding MyURL, Converter={StaticResource DBURLConverter}}" /> 

要回答有关在“详细信息”窗格中显示的具体观点,Options="None"足以使其显示在详细信息窗格中,但不能作为过滤器等。

于 2012-05-15T12:58:08.627 回答