reference from xaml to public class in .cs class file
- by netmajor
I have in my WPF project file RssInfo.cs in which I have public class
public class DoubleRangeRule : ValidationRule
{
public double Min { get; set; }
public double Max { get; set; }
public override System.Windows.Controls.ValidationResult Validate(object value,
CultureInfo cultureInfo)
{
...
}
}
and from my XAML code in WPF window class I neet to get to this DoubleRangeRule class..
//reference to my project, all my files are in the WpfCzytanieRSS namespace
xmlns:valRule="clr-namespace:WpfCzytanieRSS;assembly=WpfCzytanieRSS"
<TextBox Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" Name="tbTitle">
<TextBox.Text>
<Binding Path="Nazwa" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<valRule:DoubleRangeRule Min="0.5" Max="10"/> //error place
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
And i get two errors:
Error 1
The tag 'DoubleRangeRule' does not exist in XML namespace 'clr-namespace:WpfCzytanieRSS;assembly=WpfCzytanieRSS'.
Error 2
The type 'valRule:DoubleRangeRule' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Please help to get to class DoubleRangeRule !
:)