简体   繁体   English

是否有.NET BCL类来帮助手动滚动属性路径绑定?

[英]Is there a .NET BCL class to help with hand-rolled property path binding?

WPF and Silverlight have a data binding model whereby I can provide a Binding with a Path which comprises a dot-notation of property accessors down from a DataContext to a specific value inside a complex object graph (eg. MyDataContext.RootProperty.SubProperty.Thing.Value) WPF和Silverlight具有数据绑定模型,通过该模型,我可以提供带有路径的Binding,该路径包括属性访问器的点符号,该属性访问器从DataContext到复杂对象图中的特定值(例如MyDataContext.RootProperty.SubProperty.Thing)。值)

I have a (non-UI) requirement to accept such a path expressed as a simple string, and to use reflection on an object which is (hopefully) of a type which exposes the right property getters and setters in order to read and/or write values to those properties. 我有一个(非UI)要求,它接受以简单字符串表示的路径,并在对象上使用反射(希望)是一种类型,该类型公开了正确的属性获取器和设置器,以便读取和/或将值写入这些属性。

Before I go off and start writing the parser and reflection code, is there a handy Framework 3.5 BCL class to help with this? 在我开始编写解析器和反射代码之前,是否有一个方便的Framework 3.5 BCL类可以帮助您解决此问题?

No, but I wrote an open-source one a while ago . 不,但是我前一段时间写了一个开源的 It allows reading and writing, and also propogates INotifyPropertyChanged . 它允许读写,还可以传播INotifyPropertyChanged It is not as powerful as WPF/Silverlight (eg, no support for indexing). 它不如WPF / Silverlight强大(例如,不支持索引)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM