Autowire fields and controls?

Topics: Getting Started
Apr 9, 2013 at 4:00 PM
say I have field

private int _data;


<textblock x:name="Data">

can I make CM autocreate

public Data{get{return _data;} set{_data=value; NotifyOfPropertyChange(()=>Data);}}

and bind it?
Apr 9, 2013 at 8:33 PM
Edited Apr 9, 2013 at 8:34 PM
CM will "auto bind" the name with the property on the viewmodel but it won't automatically create the property code...
Apr 10, 2013 at 6:11 AM
why not actually? if it does that for commands, why not for properties? can any1 explain the technical reasoning behind it?
Apr 10, 2013 at 9:04 PM
Given what the framework does, I don't believe its necessary at all. But if you want to make it work fork a copy and have at it. I wouldn't subject those that put their time into maintaining the current code base with something that would be more evil than good.
Apr 10, 2013 at 10:27 PM
Commands are not generated... Actually they are not even used by CM. In .NET you cannot create field, methods, or properties to existing types. You can create new types at runtime, but this means that a whole framework should generate observable proxies for existing types, keep in sync view models with actual classes, and somehow try to identify field changes and push values to the view model. All in all, it is out of the scope of this framework, in my opinion, and I dubt the benefits would compensate the efforts.