All Questions
215 questions
0
votes
0
answers
49
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
119
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
275
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 ...
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 : ...
-1
votes
1
answer
40
views
Insert same value in textbox 2 times and checking the values are the same WPF
i'm trying to implement a feature of a textbox in wpf so that a value need to be inserted 2 times to be accepted as the value, otherwise i need to show an errore like validation error or so.
I need to ...
2
votes
1
answer
538
views
WPF Validate custom objects in ViewModel
I am using Mvvm Community Toolkit's ObservableValidator for validating viewmodel properties. When there is some custom object in my view model that is bind to the view, how to validate all of these ...
0
votes
0
answers
169
views
wpf - how to use an underlying control's validation template for an user control
I have a user control that consists of a textblock and a textbox and if I validate via INotifyDataErrorInfo the underlying data the whole control gets a red border: How it looks like
I would like to ...
0
votes
1
answer
309
views
How to get the result of a ValidationResult method, inside ViewModel? (True / False)
I have an (part of) XAML file like this
<TextBox.Text>
<Binding Path="MyProperty"
...
0
votes
0
answers
71
views
Why does my TextBox dosent work properly, when I want make the border red, if input is invalid?
basiclly the input of the TextBox is an articel number, and if the number is older then 6 Month I want to mark the border of my textbox red. For that I need to get data from an SQL Query btw.
The Code ...
0
votes
0
answers
106
views
DataTable bound to WPF DataGrid Validation in MVVM
I am working on app and part of it is:
load data from SQL database to DataTable (in ViewModel);
provide DataTable data to user (in View) using binding to DataGrid ItemsSource;
user can edit/add/...
1
vote
1
answer
109
views
How to change a parent by validating a child?
I have a DockPanel that is composed of a button and a textbox. These controls are enclosed by a border. Now I would like to validate the textbox and change the color of the border if the validation ...
1
vote
0
answers
41
views
Unblock row editing on WPF DataGrid
I have validation in DataGrid. I am copying and trying to paste multiple rows. But if there is a validation error in one of the rows on insertion, the validation will will be called in and disable ...
0
votes
1
answer
347
views
How to get when the validation state has changed in wpf?
Hi have an application that uses MVVM, there are 3 textboxes in the XAML all of which need to be not null, and there is a button that's submit at the bottom, I've already implemented a validator so ...
0
votes
1
answer
248
views
Validation when pressing button
I created validation in WPF with the help of a ValidationRule :
public class EmptyValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
...
0
votes
2
answers
474
views
Handling could not be converted values for double property in WPF
Situation
I have textbox, that is binded to a property with a type of double.
When the use tries to input a letter into the box, this shows up:
And also, this shows up in binding failure.
I ...
0
votes
1
answer
307
views
WPF, mvvm validation and ui interaction
I'm writing a WPF application using MVVM. I'm trying to understand how to use correctly this pattern for what concern validation.
For example, my application will manage data about articles. When a ...
1
vote
1
answer
580
views
Cross property validation using INotifyDataErrorInfo not working
I'm trying to implement validation in my MVVM project, with validation done at Model. Below is a minimal example:
View:
Window x:Class="Test.MainWindow"
xmlns="http://schemas....
0
votes
1
answer
551
views
validation with validation rules in WPF on button click
I have a view with a standard validation rule. It works as expected, if I tpye some text in the field, and then delete it, error icon and text are showing. Now, I would like to have the logic, if the ...
-1
votes
1
answer
297
views
Data Validation in Observable Collection child
I want to have a list of properties of different types. Each property (e.g. BoolProperty, StringProperty,..) derives from the PropertiesBase class.
PropertiesBase class has the member PropertyName.
So ...
1
vote
2
answers
231
views
Invalid value passes validation in wpf datagrid, when "Esc" is pressed
I have an Observable collection SerialList of a class SerialItem containing a single string property Number, to which I am binding a DataGrid's ItemsSource. The purpose is for the user to see some ...
0
votes
1
answer
295
views
Validation.ErrorEvent is not rised when element with error is removed
I have to show a list where each item will be validated. I am subscribed to Validation.ErrorEvent on a top level to monitor for children.
When I remove item with validation error from list this event ...
0
votes
1
answer
312
views
Disable button when validating WPF
I made a rule validation on a property. What I want is that when the condition is not satisfied the save button should be disabled. How can I do it? This is how it looks:
image. The button is not ...
0
votes
1
answer
138
views
Missing DataErrorInfoAdapter in latest MvvmValidation package
After updating the MvvmValidation NuGet package from version 2.0.2 to 3.1.0, I get the error:
The type or namespace name 'DataErrorInfoAdapter' could not be found (are you missing a using directive ...
1
vote
1
answer
306
views
Update property in ViewModel also if there are Validation-Errors
In my application I have the following definition of a DataGridTemplateColumn:
<DataGridTemplateColumn Header="Placeholder-Name" Width="*">
<DataGridTemplateColumn.CellTemplate>
...
1
vote
1
answer
655
views
Doesn't disable the button if the textbox invalid
I have the email text block with validation
<TextBox x:Name="email" Style="{StaticResource emaliStyle}" Grid.Column="2" Grid.Row="2">
<TextBox.Text>
&...
13
votes
2
answers
11k
views
How to add validation to view model properties or how to implement INotifyDataErrorInfo
I have a data collection of type ObservableCollection (say instance as myClassTypes). After some user operation, this myClassTypes populated with values in ViewModel. In view, there is a TextBox where ...
1
vote
1
answer
1k
views
How to disable button until good validation in wpf mvvm
How can I disable button until good textbox validation?
I have done some stuff but I don't know how to hide button until good validation in the right way with using MVVM pattern.
I am still learning ...
0
votes
2
answers
90
views
Input Validation in TextBox
Don't want the error message to be displayed at start/as tab opens.
Validation is implemented using IDataErrorInfo (to VM), an ErrorTemplate (XAML) is defined and able to get error message beside ...
1
vote
2
answers
155
views
C# WPF MVVM column filtering use of textboxes
In an MVVM pattern, I have 16 different strings bound to 16 textboxes for filtering columns, each of which has propertychanged assigned at creation. The logic fails due the remaining fields still ...
0
votes
1
answer
272
views
WPF MVVM Tabconrol highlight tab with validation error
I'm using WPF MVVM pattern. I have a TabControl with multiple tabs on it
All these tabs are using the same viewmodel. All the validations are working properly and as you can see in the attachement Im ...
0
votes
1
answer
256
views
Get the TabItem Name or header if it has validation Error
I have the following TabConrol
<telerik:RadTabControl
Grid.Row="2" VerticalAlignment="Top" SelectedIndex="{Binding SelectedIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
...
2
votes
1
answer
3k
views
How to make a field required, based on the value of another field
I have a ViewModel with some public properties that have data annotations, like this:
[Required]
public string PointOfContact { get; set; }
Which works just fine. I've got all of the necessary ...
0
votes
1
answer
1k
views
Display all error messages at each textbox during validation using IDataErrorInfo
I have a little issue with displaying all validations according to one property (textbox). Now my validation works as follow:
Textbox's borded is red at start and displaying ONLY ONE error message ...
0
votes
1
answer
240
views
Validation at start of application and Refresh listview when validation executes
I am developing a very simple application (I am learning C# WPF MVVM :)). I encountered 2 problems with validation.
Valdiation:
When Textbox is empty validation should start.
First problem is that, ...
0
votes
1
answer
1k
views
how to validation empty textbox when button click wpf?
I'm new in wpf and i want to make validation with error message on any empty text box user left when he click button to store data to database. I tried this in View Model. But its showing same message ...
-3
votes
2
answers
2k
views
Dynamic Validation In WPF Using MVVM?
How to do text box input validation in wpf MVVM structure?
0
votes
0
answers
118
views
wpf DelegateCommand and ValidationRules
i have have the TimePicker and validation rules
<controls:TimePicker Grid.Row="0" Grid.Column="1" Culture="Ru-ru" Margin="5,5,5,2.5">
<controls:TimePicker.SelectedTime>
...
0
votes
1
answer
334
views
How do I bind ComboBox with WPF and get SelectedItem?
I am sorry I am asking question on stack over flow first time so might be some thing i done wrong.
I have started learning WPF MVVM and I'm stuck.
I have one parameter master table in a database, ...
1
vote
0
answers
162
views
WPF DataGrid validation - showing tooltip around in cell
I have a DataGrid which looks like that:
<DataGrid ColumnWidth="45" CanUserAddRows="False" HeadersVisibility="None" ItemsSource="{Binding CorrectionMatrixA, Converter={StaticResource ...
3
votes
0
answers
536
views
Validation MarkInvalid Textbox using MVVM
I have a textbox that has validation on it, in the validation checks to see if its isNullOrEmpty. The validation works but what I am having difficulty is if the user never selects the textbox and ...
2
votes
1
answer
517
views
WPF Handling converter errors and view model validation
I have an MVVM application with INotifyDataErrorInfo all set up and functioning. Currently I am able to validate all my properties and gate the user from progressing until all errors are handled. ...
1
vote
2
answers
500
views
Textbox blank out valid value after erroneous input - WPF
So, I have a simple view containing a Textbox and a Label.
<TextBox x:Name="MyIntTextBox" Text="{Binding MyInt, UpdateSourceTrigger=LostFocus, Mode=TwoWay, StringFormat={}{D2}}"/>
<...
0
votes
1
answer
1k
views
WPF Data Annotation Validation issue
I am mostly web developer and I am super new to WPF. I am trying to work on one of the WPF project. I have hard time validating a model using a Data Annotations and MVVM. Can someone please point me ...
1
vote
2
answers
294
views
Validating UserControl's control by Window's ViewModel
Suppose, I have created custom LoginForm as an UserControl, which consists of TextBox and PasswordBox. TextBox has installed custom ErrorTemplate. Naturally, I would like to have this LoginForm as ...
2
votes
2
answers
873
views
MVVM pattern: IDataErrorInfo validation doesn't work if we have wrapped model inside another model
The problem is that the red rectangle is not shown on the UI.
I use Caliburn.Micro and this is is what I have in my View:
<StackPanel Grid.Row="0">
<Label>Customer name:</Label&...
0
votes
1
answer
1k
views
Using dataAnnonation regular expression validation attribute in Wpf Mvvm IdataErrorInfo
I'm newbie to wpf app development using mvvm. So please ignore if I am asking something out of the box. I have a model class where I am validating the data using data annotations.
Here is the code ...
1
vote
1
answer
143
views
WPF validation run-time generated forms
I'm creating a WPF application which generates a form based on a model to edit it. I use reflection to go through all properties of the model to create inputfields for the properties. The GenerateForm ...
0
votes
0
answers
96
views
Validate other user control from another
I have one user control with a combobox (UC1) and I have another user control with one text box with two buttons (UC2).
I put one instance of UC2 on MainWindow. And I need to put 5 instances of UC1 ...
2
votes
1
answer
3k
views
Error handling WPF - MVVM
I've read many articles on how to validate data in WPF - MVVM, but have gotten even more confused than I started.
What I'm trying to do is simply add a new row to my db. The validation checks if the ...