Is it possible to using XAML data binding to a model with Auto-Implemented properties?
class ClassA
{
// pseudo code.
int Width { get; set{ NotifyPropertyChange("Width");} }
}
//XAML
<textBox width="{Binding Path=Width,Mode=OneWay}"/>
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.
Auto-properties don’t have a half auto mode. It needs to either be an auto-property with nothing extra:
or a fully expanded property with a backing store that can have additional code added to it, like change notification:
If you use auto-properties you can still bind to them but you’re giving up change notification, so any changes you make to the property from code won’t show up in the UI. In general any object being used for data binding should include change notification and so should not use auto-properties.