![]() ![]() ![]() ValuePtr = Marshal. Private string SecureStringToString(SecureString value) & SecureStringToString(_password1) = SecureStringToString(_password2) IsEnabled = (_password1 != null || _password2 != null) RegisterCommand = new DelegateCommand( async () => await RegisterUserAsync() ) Public AppUserViewModel(IAuthenticationService _authService) public class AppUserViewModel : BindableBase Here is my XAML (removed quite a bit of elements for brevity): Īnd Here is my ViewModel (again, remove lot of code for brevity). It is made up of a Validating Text Box control and a Password Box control. Also, this behavior needs to be able to access the underlying ViewModel of the the element and update an INPC property in the ViewModel. to specify a username and password, and validates that it is a Workflow user. It is about how to compare two object values - does not matter if they are SecureString or not - in a XAML UserControl without breaking the MVVM pattern where a behavior attached to one element needs to know about the value of another element inside the behavior. The duplicate question mentioned in his comment is about how to compare two SecureString data types. This is not a duplicate question as mentioned in a comment. The PasswordBox uses encrypted memory (of sorts) and the only way to access the password is through the CLR property. I am trying to implement a compare behavior whose result will determine if the submit button should be enabled or disabled in the ViewModel. On one of my User Controls, I have two PasswordBoxes to compare the user entered passwords. Return Regex.IsMatch(artikelNr, artikelNrPattern, RegexOptions.I have a WPF application and am using MVVM pattern. String artikelNrPattern = // kann nur Zahlen und bindestrich(-) enthalten. Static bool IsValidArtikelNr(string artikelNr) Static bool IsStringMissing(string value) Return "invalid Article number" //TODO: Text der fehlermeldung in Ressource at least 2 characters and only numbers and – are allowed" //TODO: Text der fehlermeldung in Ressource Return "missing article number" //TODO: Text der fehlermeldung in RessourceĮlse if (!IsValidArtikelNr(this.ArtikelNr)) If (Array.IndexOf(ValidatedProperties, propertyName) < 0)ĭebug.Fail("Unexpected property being validated on Lasertrimming data: " + propertyName) String GetValidationError(string propertyName) To get started with this, you first need a model that implements IDataErrorInfo, like so… ![]() Step 1: Creating data model with IDataErrorInfo The “Add” button on the screen is also disabled/enabled in accordance to the validation via the use of WPF Command System. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |