Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
HI, sorry for my english.
I have a problem with WPF, and so have the application, where it wants to implement validation controls. I created a class StringValidation that inherits from the ValidationRule. There, I implemented the method validation. in XAML while I did something like this:
XML
<TextBox Height="23" Margin="53,39,0,0" Name="txtNazwa" VerticalAlignment="Top" TabIndex="3" MaxLines="1" GotFocus="txtNazwa_GotFocus" HorizontalAlignment="Left" Width="218"
                             ToolTip="Nazwa wybranej roli" Style="{StaticResource textBoxError}" Validation.ErrorTemplate="{StaticResource errorTemplate}">
            <TextBox.Text>
                    <Binding Path="Nazwa" UpdateSourceTrigger="PropertyChanged" >
                        <Binding.ValidationRules>
                            <s:StringValidation ValidatesOnTargetUpdated="True"
                                                                    ValidationStep="RawProposedValue"
                                                                    ErrorMessage="Error"
                                                                    TylkoNiePuste="True"
                                                                    />
                        </Binding.ValidationRules>
                    </Binding>
            </TextBox.Text>
</TextBox>


And everything started working, so I think that is ok, whereas in the designer crashes error:

Error 1 The type 's:StringValidation' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

where I added:

XML
xmlns:s="clr-namespace:MOJA.Kontrolka.Admin"


where the namespace is consistent with the StringValidation class. I do not know what it is, a very difficult job to me. Any suggestions where is the problem and how to fix / avoid?
Posted

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