Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 655535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:36:51+00:00 2026-05-13T22:36:51+00:00

I have searched on google about how to get started with the dependency property

  • 0

I have searched on google about how to get started with the dependency property used in WPF/silverlight but didn’t get any idea of the dependency property, can any one tell me about it , from beginner point of view, so that I get some idea about it and use it in my project

thanks in advance.

Can any one give me link or code example of simple application which explain in simple manner what is dependency Property is ???
I will be very thankfull

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:36:51+00:00Added an answer on May 13, 2026 at 10:36 pm

    I find that implementing a DependencyProperty often involves four parts:

    • The DependencyProperty itself
    • Property with get and set
    • Static changed handler
    • Instance change handler

    You can add a dependency property to a UserControl so that you can data bind to something in the DataContext where the UserControl is instantiated. For example you could add a property to a SoUserControl:

        #region SampleProperty // Demo for SO 2424526
    
        public static readonly DependencyProperty SamplePropertyProperty
            = DependencyProperty.Register("SampleProperty", typeof(int), typeof(SoUserControl), new PropertyMetadata(OnSamplePropertyChanged));
    
    
        /// <summary>
        /// Demo for SO 2424526
        /// Gets or sets dependency property.
        /// </summary>
        public int SampleProperty
        {
            get { return (int)GetValue(SamplePropertyProperty); }
            set { SetValue(SamplePropertyProperty, value); }
        }
    
        /// <summary>
        /// Handld changes to SamplePropertyProperty by calling a handler in the associated object.
        /// </summary>
        /// <param name="obj">object the property is associated with</param>
        /// <param name="e">details of change</param>
        static void OnSamplePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            (obj as SoUserControl).OnSamplePropertyChanged(e);
        }
    
        /// <summary>
        /// Handle changes to the SamplePropertyProperty dependency property.
        /// </summary>
        /// <param name="e">details of change</param>
        private void OnSamplePropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            int SamplePropertyNewValue = (int)e.NewValue;
            // do something with the internal logic of the control
        }
    
        #endregion
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched but apparently my google foo is weak. What I need is
I've searched for this a little but I have not gotten a particularly straight
I searched around google and stackoverflow, but didnt quite find the right answer. im
I just started studying programming about 6 months ago and I have really been
I’m trying to solve one programming mystery (to me). I have searched with Google
I searched on google but it seems to be too obvious and nobody is
I have searched both Google and this site to find an answer. I have
I have searched around, and it seems that this is a limitation in MS
I've have searched on this and it seems to be a catch all, unfortunately
How can I find the parameters of an undocumented Dll function? I have searched

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.