question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newbie question regarding validation

See original GitHub issue

I am a beginner in MVVM and I am not sure which is the best approach:

I have some domain-level models, like User, Product, ProductGroup, etc. My ViewModels only have one one property which implements INPC, like this:

public ProductGroupViewModel(ProductGroup productGroup) : Screen
        {
            _productGroup = productGroup;
        }

        private ProductGroup _productGroup;
        public ProductGroup ProductGroup
        {
            get => _productGroup;
            set
            {
                _productGroup = value;
                SetAndNotify(ref _productGroup, value);
            }
        }
}

In the View, all the binding is done like this, and this works: Text="{Binding ProductGroup.Name}"

I also use the same View / ViewModel to create a new ProductGroup and edit an existing one, through the contructor. But in this way, I cannot use Stylet IoC to inject the validator, because my contructing viewmodel does not know how to resolve such a constructor:

public ProductGroupViewModel(ProductGroup productGroup, IModelValidator<ProductGroupViewModel> validator) : base(validator)
        { ... }

What would be the recommended way to solve this issue? Thanks in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:28 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
hmihailcommented, May 25, 2017

Thanks alot! You have been a great help!

1reaction
hmihailcommented, May 22, 2017

Thanks for your support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 questions with answers in VALIDATION | Science topic
Review and cite VALIDATION protocol, troubleshooting and other methodology information | Contact experts in VALIDATION to get answers.
Read more >
Top 10 validation interview questions with answers
What experience do you have in this validation field ? Hopefully if you're applying for this position you have bags of related experience,...
Read more >
Newest 'validation' Questions
I've been working on a simple form validation code in JavaScript coupled with an HTML form. The form asks for user's basic information,...
Read more >
Newbie Question: Validating Input on Class Attributes
So, I created a class called "ZVEHICLE" and create an attribute called "TRANSMISSION" of type "ZTRANSMISSION_TYPE" (my Data Element) thinking ...
Read more >
Beginner's Guide to Design Verification & ...
Learn exactly what Design Verification and Design Validation are, ... Design validation, on the other hand, examines your user needs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found