开发者

Validation Summary in TabControl (Silverlight 4)

开发者 https://www.devze.com 2023-01-10 07:47 出处:网络
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.

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>
  开发者_如何学Go              <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?


Walkor, see this: Using BindingValidationError to Add Messages to a Validation Summary in Silverlight

Hope helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消