reference from xaml to public class in .cs class file
Posted
by netmajor
on Stack Overflow
See other posts from Stack Overflow
or by netmajor
Published on 2010-03-26T23:27:04Z
Indexed on
2010/03/26
23:33 UTC
Read the original article
Hit count: 485
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 !
:)
© Stack Overflow or respective owner