All Questions
Tagged with validation wpf
1,219 questions
0
votes
0
answers
30
views
WPF DataGrid disabling editing on validation errors
My view has a DataGrid that displays a ObservableCollection<MyViewModel>. To validate the input of MyViewModel properties, I use a ValidationRule that checks all model properties in the Validate ...
0
votes
0
answers
50
views
In WPF app form validation errors not showing up in UI
I'm new to WPF and I need to create a small app in .NET8 that generates text files. In UI I want to have two mandatory fields, one of them accepting only numbers greater than 0. I used fluent ...
0
votes
1
answer
45
views
How to pass information from the view model to a validation rule
I'm quite new to programming C# and WPF. I have two TextBoxes where I want to validate user input with validation rules:
<TextBox
x:Name="TextBox1">
<TextBox.Text>
...
0
votes
1
answer
120
views
Validation ErrorTemplate shows on `ContentControl` instead of `TextBox`
Problem
I'm trying to generate visual feedback on the result of validating a TextBox input control with the following requirements:
A red box is displayed around the textbox border
Any error messages ...
0
votes
1
answer
323
views
MVVM Toolkit Data Validation and ObservableProperty
I'm working in WPF and using the MVVM community toolkit. Reading the documentation, I understand that I can make validation work by inheriting from ObservableValidator and using this pattern for my ...
-1
votes
1
answer
44
views
How do I use validation to prevent a user from duplicating Datagrid value?
I am trying to figure out how to prevent users from adding or renaming fields in a datagrid, if the value they choose is a duplicate. For example, if there is a directory of Person objects, if someone ...
1
vote
2
answers
71
views
WPF show validation errors under custom button [duplicate]
I am creating a WPF application with the MVVM pattern.
Validation errors are managed by using INotifyDataErrorInfo. The ViewModel implements INotifyDataErrorInfo.
For System.Windows.Controls controls ...
0
votes
1
answer
49
views
Timing problem in WPF data binding in styles
I wanted to have data validation at once in WPF binding so I used PropertyChanged at UpdateSourceTrigger. At the same time I wanted to detect LostFocus, this is the time I modify the DB. Moreover, I ...
0
votes
0
answers
50
views
INotifyDataErrorInfo - Red border doesn't disappear when error is cleared
Please check below a simple project reproducing the issue.
The issue is that the red border (meaning there is an error) remains on my control even though error is cleared.
In a WPF app, I have a "...
-1
votes
1
answer
326
views
WPF TextBox Validation using INotifyDataErrorInfo
I have created a Custom TextBox control, which overrides TextBox. I have it all working perfectly and I also have validation working with an Override of OnTextChanged.
The issue I have now is that the ...
1
vote
0
answers
46
views
WPF - validation adorners do not position correctly when there multiple controls with validation errors
I have a WPF application built with .NET Framework 4.8. I have a viewmodel that implements INotifyDataErrorInfo for validation. In my XAML I am using the default Validation.ErrorTemplate, but I have ...
1
vote
0
answers
59
views
WPF Telerik RadGridView prevents button clicking when cell value is invalid
I have a telerik:RadGridView cell with validation that works as intended; however, in the cases where the cell is invalid, all the buttons on that same window don't respond. I added code to disable my ...
0
votes
1
answer
41
views
ValidationRule with UpdateSourceTrigger=LostFocus not firing when textbox loses focus
I am attempting to implement validation for form data in a WPF application.
View
<StackPanel Orientation="Horizontal" Margin="0 5 0 5">
<TextBlock Style="{...
0
votes
1
answer
247
views
WPF-UserControl with the .NET library FluentValidation
I use WPF with MVVM and for validation the .NET library FluentValidation (https://github.com/FluentValidation).
With a TextBox and a simple validation
RuleFor(x => x.Name).NotEmpty().WithMessage(&...
0
votes
3
answers
6k
views
MVVM Community Toolkit: Using ObservableValidator with non-string properties
I have a WPF application that uses the ObservableValidator to handle validation of properties using data annotations. This works great for string properties. For example:
public class LoginViewModel : ...