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 3217470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:24:53+00:00 2026-05-17T15:24:53+00:00

I am new to WPF so after reading for a while I deduce that

  • 0

I am new to WPF so after reading for a while I deduce that my problem needs to be handled with this pattern: DependencyProperty.

I want my ToggleButton to have another boolean property.

My problem is where should I assign this property, and how? Inside the object that is bound to the ToggleButton?

Let’s say I have a class cell (which is bound to this Button) that when clicked I want that from this point on, it would hold new face with trigger on.

My new property will be:

 bool wasClick 

Can someone explain to me how I should write it and tell me more about this new concept?

EDIT:
The main topic is where should I define it so I want it asoocited to a Button but where should I write the code. Lets say I have a class that is bound to a Button. Should I write:

public static readonly DependencyProperty IsSpinningProperty = 
       DependencyProperty.Register(
...    "IsSpinning", typeof(Boolean),

in this class or should I write it in my view model? If so, where and how?

  • 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-17T15:24:54+00:00Added an answer on May 17, 2026 at 3:24 pm

    As the name implies (kind of poorly), a dependency property is a property whose value can depend on something else. Generally, this means a property whose value gets determined automatically (and dynamically) by the WPF framework under certain conditions. The most common conditions are:

    • The property has a default value, or inherits its value from an ancestor in the visual tree. In this case, the property’s value is determined without it ever being set.
    • The property is the target of data binding.
    • The property’s value is set by an animation.

    Not all properties whose value gets set by the WPF framework need to be dependency properties. Any CLR property with a public getter and setter can be the source of a two-way data binding.

    In your case, it sounds like you don’t really need a dependency property, not if you’re using a view model. You could just do this (assuming that you’ve implemented property-change notification in your class):

    private bool _IsChecked;
    
    public bool IsChecked
    {
       get { return _IsChecked; } }
       set
       {
          if (value == _IsChecked)
          {
             return;
          }
          _IsChecked = value;
          WasChecked = WasChecked || value;
          OnPropertyChanged("IsChecked");
       }
    }
    
    private bool _WasChecked;
    
    public bool WasChecked
    {
       get { return _WasChecked; }
       private set
       {
          if (value == _WasChecked)
          {
             return;
          }
          _WasChecked = value;
          OnPropertyChanged("WasChecked");
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to WPF and I am having a problem with inheriting
I'm new to WPF and data binding so hopefully I can explain the problem
I am new to WPF and XAML, but after a few hours of googling
I'm new to WPF so I've got a problem: I need to create a
I started a new WPF project in VS2008 and then added some code to
I'm VERY new to WPF, and still trying to wrap my head around binding
A bit new with WPF...It seems like not matter what I change with horizontal
I'm new to WPF and come from a WinForms background and have a fairly
Ok... I'm new to WPF, but I kind of know how to do things
Hello there and Merry Christmas !!! I am new to WPF and I am

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.