i have code like
e.CanExecute = tabEditor.IsFocused;
but at runtime, i get a null reference exception error. but in the docs, IsFocused returns only true or false, why is this happening? btw, tabEditor is a <TabItem>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Chances are that either
eortabEditoris null, i.e., they weren’t assigned to an object anywhere (or otherwise explicitly assigned tonull). If the code is in an event handler, it’s possible that the framework hasn’t initialized all the variables by the time the event handler is called, in which case you might want to check for null.