更简单的依赖属性?

发布于 2024-09-07 08:29:01 字数 236 浏览 1 评论 0原文

我被用来为我的自定义控件创建依赖属性。 但我真的厌倦了定义静态字段、在构造函数中填充它们、对标准属性和后来的事件进行编码、以及转换和验证对象,尽管有复制和验证的帮助。粘贴和代码片段。

所以,问题是……是否有任何努力、倡议、群众请愿、框架、工具、项目或想法来使依赖属性的创建变得更容易?

也许 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如此安好 2024-09-14 08:29:01

Visual Studio 定义了几个开箱即用的代码片段:

propdp[TAB]

依赖属性

propa[TAB]

附加属性

我一直使用它们! :)

There are several out of the box code snippets Visual Studio defines:

propdp[TAB]

Dependency property

propa[TAB]

Attached property

I use them all the time! :)

帅哥哥的热头脑 2024-09-14 08:29:01

在 VS2010(不确定 2008)中,您可以使用内置的代码片段:输入 propdp 并按 Tab 两次来创建 DependencyProperty 定义。

In VS2010 (not sure about 2008) you can use the built in code snippets: type propdp and press Tab twice to create a DependencyProperty definition.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文