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

  • SEARCH
  • Home
  • 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 8503051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:39:09+00:00 2026-06-11T01:39:09+00:00

I have a C# custom WPF control. I have properties on the control that

  • 0

I have a C# custom WPF control. I have properties on the control that are based on DependencyProperty’s.

public static readonly DependencyProperty CurrentStateProperty = 
 DependencyProperty.Register( "CurrentState", typeof(ControlStateEnum),
 typeof(MyCustomControl), new PropertyMetadata(ControlStateEnum.Started));

public ControlStateEnum CurrentState
{
    get { return (ControlStateEnum) GetValue(CurrentStateProperty); }
    set { SetValue(CurrentStateProperty, value); }
}

Now, if I use the control, and try to use it, ala:

<myControls:MyCustomControl CurrentState="Loaded" />

The CurrentState never gets set to “Loaded” and remains “Started”. I want to make it capable of binding, but also capable of being set without binding… Is there something I don’t understand or am missing?

When I set a breakpoint on the setter, it doesn’t update on the window load.

  • 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-06-11T01:39:11+00:00Added an answer on June 11, 2026 at 1:39 am

    So, in the end the value was being set on the control from the XAML after the control had been initialized and loaded. So the way to handle it was to add a PropertyChangedHandler on the DependencyProperty.

    parapura had a link to the right answer (http://stackoverflow.com/questions/4225373/setters-not-run-on-dependency-properties).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In WPF, I have a custom control that inherits from TreeView. The code is
In my WPF project I have a custom control with some properties assigned, they
I have a custom control in WPF that simply holds a combo box (however
I have a custom WPF user control called a TimeoutPanel that I am trying
I have a custom wpf control to do an arbitrary reverse image warp, that
I have a custom WPF control MyLine that should represent or not some text
I have a custom WPF control that I made a couple of days ago:
I have a custom WPF control base class. This base class registers a custom
In a WPF/MVVM application I have a custom control on a particular view. This
I have a WPF application where I'd like to create a custom pop-up that

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.