views:

314

answers:

0

Hello, everyone. Here is my question. I'm using MVVM pattern in my project and i have a UserControl, which has a TabControl on it. TabItems have validations on them.

Main page looks like this:

<UserControl>
    <DataInput:ValidationSummary x:Name="ValidationSummary"/>
    <Grid x:Name="LayoutRoot">
        <DataInput:ValidationSummary />
        <TabControl x:Name="TabControl">
            <TabItem>
                <MyUserControl1 DataContext="{Binding}" />
            </TabItem>
            <TabItem>
                <MyUserControl2 DataContext="{Binding}" />
            </TabItem>
            <TabItem>
                <MyUserControl2 DataContext="{Binding}" />
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>

And here is a sample code for TabItems:

<UserControl>
   <Grid>
     <Text:ExtendedTextBox Text="{Binding Name, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
     <Data:DataGrid SelectedItem="{Binding SelectedValue, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}"/>
   </Grid>
</UserControl>

Target for ValidationSummary is set to LayoutRoot. But actually, 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?