canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
988 stars 143 forks source link

About CanExecute Err! #157

Closed wf-soft closed 3 years ago

wf-soft commented 3 years ago

Hi! @canton7 How to handle "bool Canxxx = > View.xxx" This exception is initialized to null.

image

If I use datagroupv?. DG SelectedItems.Count ==1; popup's MenuItem will be disabled forever and cannot be refreshed

canton7 commented 3 years ago

As the message says, DataGroupV is null, so calling DataGroupV.dg gives you a NullReferenceException.

If I use datagroupv?. DG SelectedItems.Count ==1; popup's MenuItem will be disabled forever and cannot be refreshed

You'll have to debug why that is.

I'm afraid this isn't a question specifically about Stylet: you'll get much better support somewhere else, like StackOverflow.