.netxamlsilverlightvalidationsummary

Change icon in validationsummary in silverlight


I want to change the icon at the top left corner in the validation summary because it's not company compliant.

validation summary icon

Is this possible? I found nothing on google...


Solution

  • The icon is encoded in the ValidationSummary's HeaderTemplate. The original template is available here (Search for <Path Fill="#DDD43940" Data="M5.5,2.5 L7.5,2.5 L7.5,8 L5.5,8 M5.5,9.5 L7.5,9.5 L7.5,10.5 L5.5,10.5"/> - this is the exclamation mark).

    Here's an example of how to customize the header:

    <ctl:ValidationSummary>
      <ctl.ValidationSummary.HeaderTemplate>
        <DataTemplate>
          <Border Background="#FFDC020D">
            <StackPanel Orientation="Horizontal">
              <Image Source="/MyCustomImage.png" />
              <TextBlock Text="{Binding}" Foreground="#FFFFFF" FontWeight="Bold" />
            </StackPanel>
          </Border>
        </DataTemplate>
      </ctl.ValidationSummary.HeaderTemplate>
    </ctl:ValidationSummary>