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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:52+00:00 2026-05-28T07:17:52+00:00

I have a dependency property(List of string) in a user control in my dot

  • 0

I have a dependency property(List of string) in a user control in my dot net assembly as below

public partial class ItemSelectionUserControl : UserControl
{
   public List<string> AvailableItems
    {
        get { return (List<string>)this.GetValue(AvailableItemsProperty); }
        set { this.SetValue(AvailableItemsProperty, value); }
    }
    public static readonly DependencyProperty AvailableItemsProperty = DependencyProperty.Register(
      "AvailableItems", typeof(List<string>), typeof(ItemSelectionUserControl), new FrameworkPropertyMetadata{BindsTwoWayByDefault =true});


    public ItemSelectionUserControl()
    {
        InitializeComponent();
    }


}

I am trying to use this usercontrol in another usercontrol in a different assembly as below

    <UserControl 
     xmlns:ctrl="clr-namespace:HH.Windows.UserControls;assembly=HH.Windows.UserControls"
    />

   // .....
    <Grid>
     <ctrl:ItemSelectionUserControl Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="3" AvailableItems="{Binding Path=CheckList}"/>
    </Grid>

I can see the get accessor of CheckList is getting called, but it is not setting the dependency property “AvailableItems”. The breakpoint in the set of “AvailableItems” is never getting called. What am I doing wrong?

  • 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-28T07:17:53+00:00Added an answer on May 28, 2026 at 7:17 am

    As far as I’m aware, WPF may not call the setter of your property directly if it exposes a DependencyProperty. Instead it can set the DependencyProperty directly. For more information, see Dependency Properties Overview on MSDN. In particular this section:

    Dependency Properties Might Be “Set” in Multiple Places
    The following is example XAML where the same property (Background) has three different “set” operations that might influence the value …

    To test whether this is occurring in your example (plus get a notification where you can operate on the set value), you can try adding a Callback in the FrameworkPropertyMetadata

    e.g.

    public partial class ItemSelectionUserControl : UserControl 
    {    
        public List<string> AvailableItems     
        {         
            get { return (List<string>)this.GetValue(AvailableItemsProperty); }         
            set { this.SetValue(AvailableItemsProperty, value); }     
        }     
    
        public static readonly DependencyProperty AvailableItemsProperty = 
            DependencyProperty.Register("AvailableItems", 
            typeof(List<string>), typeof(ItemSelectionUserControl), 
            new FrameworkPropertyMetadata(OnAvailableItemsChanged) 
            {
                BindsTwoWayByDefault =true
            });       
    
        public ItemSelectionUserControl()     
        {         
            InitializeComponent();     
        }   
    
        public static void OnAvailableItemsChanged(
               DependencyObject sender, 
               DependencyPropertyChangedEventArgs e)
        {
            // Breakpoint here to see if the new value is being set
            var newValue = e.NewValue;
            Debugger.Break();
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following ViewModel-Property: public List<List<string>> Names .... //It's a dependency property In
I have the following dependency property inside a class: class FooHolder { public static
I have a two dependency properties(both List of strings) in a custom user control.The
I have a string dependency property (SearchText), when updated, needs to update a collection
I have essentially the same problem discussed here: http://khason.net/blog/dependency-property-getters-and-setters-in-multithreaded-environment/ public static readonly DependencyProperty MyPropertyProperty
I have a user control that exposes a property of type ImageSource. I want
I have a Dependency Property like this public static readonly DependencyProperty ShowTooltipProperty = DependencyProperty.Register(
I have one problem. i have dep. prop. of type List.. public const string
I want to have a User Control that takes a collection of People (property
I have a Dictionary<string, FieldDefinition> dependency property that when I bind it to a

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.