Question regarding ViewModel.CanCreate property

Question regarding ViewModel.CanCreate property

Old forum URL: forums.lhotka.net/forums/t/9689.aspx


Smith866 posted on Thursday, October 28, 2010

I have a question regarding the intent of the ViewModel.CanCreate property (in ViewModelBase).  The code documentation on that property says the following:

Gets a value indicating whether an instance of the Model can currently be created.

I have noticed that this property will always be set to false before the model is loaded, as the SetProperties() method of ViewModelBase requires that the Model exists (not be null) before it will consider setting it to true.

I had wanted to bind the IsEnabled property of my Add button to this control, so that when a user navigates to this view, they will be able to add a new record, if they have permission.  However, it looks like I must first load something into the model before I can get CanCreate to be true.

Have I missed the intent of this property, or is there an issue with the CanCreate property?

RockfordLhotka replied on Thursday, October 28, 2010

That sounds like a bug...

Copyright (c) Marimer LLC