Quickly create dependency properties in VS

2020-08-09 06:53发布

Is there any way how to speed up dependency properties creating in VS? Like some template or refractoring option that will make dependency property out of normal one. Anything. I create a lot of dependency properties right now...

Thank you for help

5条回答
我命由我不由天
2楼-- · 2020-08-09 07:21

New(ish) versions of Resharper

Newer versions of Resharper come with the dependencyProperty snippet built in. So start typing "dependencyProperty" and it should pop up as an option for you to select (with the tab key).

In my opinion, this option is preferable because it comes with better defaults and formatting.


Old versions of Resharper

If you're using an old ReSharper but still want to use Visual Studio's dependency property code snippet (without downloading anything), type PROPDP in all caps and then hit tab once.

Intellisense will come up with "No suggestions" but insert the code snippet anyway.

查看更多
萌系小妹纸
3楼-- · 2020-08-09 07:28

There are code snippets for dependency properties. (such as propdp)

See this article for more information.

You can get some here.

查看更多
Viruses.
4楼-- · 2020-08-09 07:31

I have, and still use these 5 dependency snippets which will add reference or value dependencies as selected. They were created for Silverlight (it was hot at the time, you youngins) but the code they lay down works in WPF and Visual Studio 2017.

Helpful Silverlight Snippets

查看更多
兄弟一词,经得起流年.
5楼-- · 2020-08-09 07:36

As a side note, (and someone correct me if I'm wrong please!).

If you're using ReSharper, it overrides the default snippet/templating system and doesn't have a propdp equivalent as shipped.

I found a ReSharper propdp snippet here.

查看更多
小情绪 Triste *
6楼-- · 2020-08-09 07:38

The code snippet for DPs is propdp, enter that and hit tab twice, then cycle through the fields with tab and fill them in.

查看更多
登录 后发表回答