如何自定义ValidationSummary Silverlight控件的HeaderTemplate?

时间:2010-11-19 12:16:06

标签: silverlight validation xaml validationsummary

我想从 Silverlight Toolkit 自定义 ValidationSummary 控件的 HeaderTemplate ,并显示本地化的标题。但我无法弄清楚如何在标题文本中显示错误计数器...
有人可以帮我吗?

我目前的XAML代码......

<sdk:ValidationSummary Grid.Row="3">
<sdk:ValidationSummary.HeaderTemplate>
    <DataTemplate>
        <Grid Background="Red">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock UseLayoutRounding="False"
                       Foreground="White"
                       Text="Editing Errors:" />
            <TextBlock UseLayoutRounding="True"
                       Foreground="White"
                       FontWeight="Bold"
                       Text="{Binding DisplayedErrors.Count}"
                       Grid.Column="1" />
        </Grid>
    </DataTemplate>
</sdk:ValidationSummary.HeaderTemplate>

提前致谢!

2 个答案:

答案 0 :(得分:2)

是的,我只缺少DisplayedErrors.Count!那就是问题所在!

答案 1 :(得分:0)

从Text =“{Binding DisplayedErrors.Count}”语句中删除“DisplayedErrors.Count”,仅保留Text =“{Binding}”