DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone >

Creating an IntelliSense Compatible Enum-Based Dependency Property

Tim Dams user avatar by
Tim Dams
·
May. 30, 12 · · Interview
Like (0)
Save
Tweet
5.99K Views

Join the DZone community and get the full member experience.

Join For Free

actually, this post has a way too fancy title , because in fact i will merely show that enum-based dependency properties are intellisense compatible “out-of-the-box”. (by the way, if you know all about dependcy properties: simply read the line in bold and you’ll know all there is to know).

when creating a (wp7/sl/wpf) usercontrol, one often ends up creating one more dependency properties (dp). most of the times you only want a discrete set of possible values that can be assigned to the dp. the logical choice then of course is to have an enum-based dp.

now, for the intellisense to work it is important that you define the enum type outside the usercontrols class. for example, suppose we have define the following enum:

now, all that remains is to add a dp that uses this enum (remember that you can use the ‘dependencyproperty’ snippet that comes with vs):

once you now add the usercontrol elsewhere in your xaml-code, intellisense will happily show what values can be assigned to the dp:

there we go. that’s all there was too it.

next post i’ll show how to create a wp7 user control to plot graphs using data binding. consider some of the code here a sneak preview.

Property (programming) Dependency

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • SDLC Vs STLC: What's the Difference?
  • Take Control of Your Application Security
  • How to Test JavaScript Code in a Browser
  • ETL, ELT, and Reverse ETL

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo