Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am using MVVM pattern in my project and used Tab Control. Tab Items have validation.
HTML
<usercontrol>
    <grid x:name="Layout Root" xmlns:x="#unknown">
        <tabcontrol bindingvalditionerror="TabControl_validtion" x:name="TabControl">
            <tabitem>
                <myusercontrol1 datacontext="{Binding}" />
            </tabitem>
            <tabitem>
                <myusercontrol2 datacontext="{Binding}" />
            </tabitem>
            <tabitem>
                <myusercontrol2 datacontext="{Binding}" />
            </tabitem>
        </tabcontrol>
    </grid>
</usercontrol>

C#
private void TabControl_validtion(object sender, ValidationErrorEventArgs e)
      {
          switch (e.Action)
          {
              case ValidationErrorEventAction.Added:
                  if (!Errors.Contains(e.Error))
                  {
                      this.Errors.Add(e.Error);
                  }
                  break;
              case ValidationErrorEventAction.Removed:
                  this.Errors.Remove(e.Error);
                  break;
              default:
                  break;
          }
      }

it's showing only errors for visible(currently opened) TabItem. And i need to show all the errors from all tabs. How can i achieve this?
Posted
Updated 27-Sep-12 19:14pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900