Everything works great, the only issue I have is that the binding I'm doing on the IsReadOnly attribute which goes to a boolean in my ViewModel which is set based on a call to an authentication service, is now overriding the label Content to the name of my ViewModel property: IsNotAdmin. I can't seem to find a way to specify which data binding source to pull the label content MetaData from. Maybe I'm missing something on how to manipulate control editablity/visibility from my ViewModel.

--Update: The data source class that the TextBox is bound to is as follows (for the relevant parts):

1 Answer
1

can you post more of your code? I'm not entirely sure what it is that you're trying to make happen so it's hard to propose a solution.

I assume you're trying to create a text entry element that has validation performed on it (hence the label) -- but what exactly is the label supposed to be showing for it's content?

EDIT: I figured this out. The label control by default looks through all the properties in its datacontext looking for metadata it can use. For whatever reason it decided to use the metadata for the IsNotAdmin property in your code (even though you didn't set it manually, I assume that the Display metadata gets a default value of the property name), and so you get that for the text of the label.

Microsoft put in a property specifier into the data controls so you can tell it which property it should use for the metadata lookup: PropertyPath

Hi -- the data source for the text box has the Display(name=) data annotation attribute applied to the Job_Code property and is set to "Job Code (To be completed by HR)" which is what is displays very nicely if I remove the binding on the IsReadOnly attribute. When I add the binding in the Label displays "IsNotAdmin"
–
jemerickDec 17 '09 at 17:37