A
A
Anton Ivanov2021-04-11 11:48:22
WPF
Anton Ivanov, 2021-04-11 11:48:22

How to skip the initialization of the ViewModel class in wpf for an element that is not visible?

There is a User Control that is hidden (Visibility=Hidden) if the user does not have enough rights.
But the datacontext class constructor for this control is called anyway. And you also have to check the rights of the current user in the constructor (well, this is how it should be done anyway, but still ...)

You can somehow make it so that if the User Control is not visible, then the data context would not initialized?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question