更简单的依赖属性?
我被用来为我的自定义控件创建依赖属性。 但我真的厌倦了定义静态字段、在构造函数中填充它们、对标准属性和后来的事件进行编码、以及转换和验证对象,尽管有复制和验证的帮助。粘贴和代码片段。
所以,问题是……是否有任何努力、倡议、群众请愿、框架、工具、项目或想法来使依赖属性的创建变得更容易?
也许 C# 5.0 pre CTP 的“编译器即服务”和“元编程”来定义如此复杂的 WPF/Silverlight 功能。那真是太有帮助了!
I'm being used to create Dependency Properties for my custom controls.
But i'm really tired of defining static fields, populating them in the constructors, coding the standard properties and later the events, plus casting and validating objects, all despite the help of copy & paste and code snippets.
So, the question is... is there any effort, initiative, crowd-petition, framework, tool, project or idea to make the creation of dependency properties EASIER?
Maybe a C# 5.0 pre CTP of "Compiler as Service" and "Meta-Programming" to define such complex WPF/Silverlight features. That would be so helpful!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Visual Studio 定义了几个开箱即用的代码片段:
依赖属性
附加属性
我一直使用它们! :)
There are several out of the box code snippets Visual Studio defines:
Dependency property
Attached property
I use them all the time! :)
在 VS2010(不确定 2008)中,您可以使用内置的代码片段:输入
propdp
并按Tab
两次来创建 DependencyProperty 定义。In VS2010 (not sure about 2008) you can use the built in code snippets: type
propdp
and pressTab
twice to create a DependencyProperty definition.