Validation Summary in TabControl (Silverlight 4)

谁说我不能喝 提交于 2019-12-14 02:01:30

问题


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?


回答1:


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

Hope helps!



来源:https://stackoverflow.com/questions/3403491/validation-summary-in-tabcontrol-silverlight-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!