I filled a combobox in codebehind and it works correctly. I also set its visibilty to visibility.collapsed in the same function without problem.

when I try to set it to visibility.collapsed later (checkbox checked event) I crash saying something is null. Same thing if I try to set isenabled or anything else. I would think it was a scope problem but it is declared in wpf so it should be available to all code in the codebehind right? If that was the problem then I shouldn't have been able to populated the list from codebehind either as far as I know.

Any thoughts?