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

The Archive Base Latest Questions

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

I have just started to create a user control realising that I want a

  • 0

I have just started to create a user control realising that I want a lot more out of the DataGrid. Don’t worry about the details for now but I have created a DependencyProperty called TheColumns :

 public static readonly DependencyProperty TheColumnsProperty = DependencyProperty.Register("TheColumns", typeof(List<DataGridColumnItem>), typeof(ExtendedDataGrid), null);

DataGridColumnItem is just an independent class I created to hold column information etc.

I then declared a property to get and set the value :

 public List<DataGridColumnItem> TheColumns
 {
     get
     {
         return (List<DataGridColumnItem>)GetValue(TheColumnsProperty);
     } 
     set
     {
         SetValue(TheColumnsProperty, value);
         TheDataGrid.Columns.Clear();

         foreach (var col in TheColumns)
         {
             var newCol = new DataGridTextColumn();
             newCol.Header = col.Header;
             var columnBinding = new Binding(col.DataBindingMember);
             newCol.Binding = columnBinding;

             TheDataGrid.Columns.Add(newCol);
         }
    }
}

OK, this is all a simple test before I do it properly becase I wanted to set my columns from a view model, as there is no proper column binding in the dataGrid itself. Oh, I want to determin the colum order, visibility and what is actually going to be displayed at run time, not in xaml.

I have a property in my view model called GridColumns declared as :

public List<DataGridColumnItem> GridColumns ….

I have boud this property in xamle like :

TheColumns="{Binding Path=GridColumns}"

OK, now I created an instance of the view model and set it to the DataContext of the Window in which the user control is housed. When I run it, the property IS read from the view model but the setter on the dependency property does not fire. If I remode the xaml assignment the property on the view model does not fire. Therefore, the property is being read but not made use of.

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

    You ran into this: Setters not run on Dependency Properties?
    Essentially you need to hookup the PropertyChangedCallback and do your logic in there.

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

Sidebar

Related Questions

I have just started learning Erlang and am trying out some Project Euler problems
I have just started migrating my homegrown persistence framework to JPA. Given that the
I have just started to create a stored function this is my first time
I have just started out learning rails and ruby, so please bear with me
I have just started playing with the ASP.Net MVC framework, and today I created
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I have just started using silverlight 2 beta and cannot find how to or
I have just started using Boost 1.36. These libraries would be very useful in

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.