如何自定义Silverlight ValidationSummary控件的HeaderTemplate?
我想自定义 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>
提前致谢!
I'd like to customize HeaderTemplate of ValidationSummary control from Silverlight Toolkit and display localized Header. But I cant figure out how to display error counter right to header's text ...
Can anybody help me with this?
My current XAML code ...
<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>
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我只缺少 DisplayedErrors.Count!这就是问题所在!
Yes, I'm missing only DisplayedErrors.Count! That's the problem!
从 Text="{Binding DisplayedErrors.Count}" 语句中删除“DisplayedErrors.Count”,仅保留 Text="{Binding}"
Remove "DisplayedErrors.Count" from the Text="{Binding DisplayedErrors.Count}" statement keeping only Text="{Binding}"