C# 将用户控件绑定到contentcontrol验证规则不触发

C# 将用户控件绑定到contentcontrol验证规则不触发,c#,wpf,validation,user-controls,validationrules,C#,Wpf,Validation,User Controls,Validationrules,我有许多用户控件,我有一个主窗口,其中包含一个内容控件和列表框。当用户从列表框中选择时,我将所选用户控件绑定到内容控件。问题是当用户控件第一次绑定验证规则时,但当用户控件第二次绑定验证规则时消失什么问题? 这是主窗口: <Grid> <ListBox x:Name="FormsListBox" Margin="0,5,0,5" Grid.Row="1" Grid.Column="0" Width="180" ItemsSource="{Binding Formlist

我有许多用户控件,我有一个主窗口,其中包含一个内容控件和列表框。当用户从列表框中选择时,我将所选用户控件绑定到内容控件。问题是当用户控件第一次绑定验证规则时,但当用户控件第二次绑定验证规则时消失什么问题? 这是主窗口:

<Grid>
    <ListBox x:Name="FormsListBox" Margin="0,5,0,5" Grid.Row="1" Grid.Column="0"  Width="180" ItemsSource="{Binding Formlist}" SelectedItem="{Binding SelectedFormInfo}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <Image Source="Resources/Capture.PNG" ></Image>
                    <TextBlock Text="{Binding Path=FormName}"></TextBlock>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
    <StackPanel Grid.Row="1"  Grid.Column="1" x:Name="MainStackPanel" >
        <ContentControl  Content="{Binding Path=SelectedFormInfo.MainForm}">

        </ContentControl>
    </StackPanel>
</Grid>
以下是用户控件中验证角色的示例:

<StackPanel Width="315" Margin="20,0,10,0">
    <TextBox x:Name="TxtWeaponNumber" Width="315">
        <TextBox.Text>
            <Binding Path="SelectedWeapon.weaponNumber" Mode="TwoWay"
                UpdateSourceTrigger="PropertyChanged" ValidatesOnNotifyDataErrors="True"
                ValidatesOnDataErrors="True" NotifyOnValidationError="True"
                NotifyOnSourceUpdated="True" NotifyOnTargetUpdated="True">
                <Binding.ValidationRules>
                    <validationRules:RequiredRule ValidatesOnTargetUpdated="True" ValidationStep="RawProposedValue" />
                </Binding.ValidationRules>
            </Binding>
        </TextBox.Text>
    </TextBox>
</StackPanel>

注意:SelectedFormInfo中的Main表单包含选定的用户控件

我在AdorneDecorator中设置了我的用户控件,验证没有消失