wpf,vb.net,mvvm,combobox,idataerrorinfo
Solved .. This is the solution Public Property USER() As String Get Return p_USER End Get Set(ByVal value As String) p_USER = value OnPropertyChanged("USER") OnPropertyChanged("User_USER") End Set End Property...
You can implement your OptionalPhoneAttribute based on the original PhoneAttribute: public sealed class OptionalPhoneAttribute : ValidationAttribute { public override bool IsValid(object value) { var phone = new PhoneAttribute(); //return true when the value is null or empty //return original IsValid value only when value is not null or empty return...
c#,.net,wpf,xaml,idataerrorinfo
In my opinion if your resource key is defined in the App.xaml then it should work. But your resource key is probably in resource in some user control. (string)App.Current.Resources[messageCode]; search only in the App.xaml resource. Solution for you can be use multivalueconverter class MessageCodeToMessageConverter : IMultiValueConverter { public object Convert(object[]...
Don't catch any exceptions in the ViewModel properties: public string Name { get { return myBl.Name; } set { myBl.Name = value; } } and check the ValidateOnExceptions option in the data binding dialog (or ValidatesOnExceptions=True in the XAML code)....
c#,wpf,fluentvalidation,idataerrorinfo
The problem you have is that if you choose to use the Validate overload that requires a lambda expression to evaluate your property you'll have to do: Instead of: validator.Validate(this, SomeProperty); you need: validator.Validate(this, s => s.SomeProperty); Here this overload documentation: Alternatively you can use the other Validate overload and...
wpf,mvvm,icommand,idataerrorinfo,relaycommand
You haven't really added enough code for us to accurately tell you what your problem is. However, you are taking the correct approach. I also use the IDataErrorInfo interface, but I added some extra properties into my base class that implements it: public string Error // actual IDataErrorInfo Member {...
wpf,validation,xaml,idataerrorinfo
To acheive you goal you need to: First, remove ValidatesOnDataErrors="True" on your Binding. As said in docs: Setting this property provides an alternative to using the DataErrorValidationRule element explicitly And we're gonna use it explicitly. Then use DataErrorValidationRule instead of ExceptionValidationRule for correctly working with IDataErrorInfo and data errors. And...
c#,wpf,binding,controltemplate,idataerrorinfo
I solved it by myself. The solution is only one ControlTemplate where the ImageSource and the BorderBrush are bound to a UserGroup-Property and the decision is done in two converters. The ControlTemplate looks like: <ControlTemplate x:Key="TextBoxErrorTemplate" TargetType="Control"> <Grid ClipToBounds="False"> <Border BorderThickness="1" Margin="-1" BorderBrush="{Binding DataContext.UserGroup, Converter={converters:UserGroupToBrushConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}">...