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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:22:19+00:00 2026-05-23T01:22:19+00:00

Let me explain my situation. I have made a user control that contains an

  • 0

Let me explain my situation. I have made a user control that contains an ItemsControl

<ItemsControl Name="itemControlReviewTags">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                    <my:ReviewControl ReviewEvent="{Binding}" />
                        <TextBlock Text="{Binding Text}" />
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

This ItemsControl is bound to an observablecollection in the code behind

public ObservableCollection<TagEvent> tagItems = new ObservableCollection<TagEvent>();

The collection is set on the ItemsControl like so

itemControlReviewTags.ItemsSource = tagItems;

The TagEvent class is defined like below. The class is added to the collection at certain events.

public class TagEvent : EventArgs
{
    public string Text { get; set; }
    public string Comment { get; set; }
    public string Value { get; set; }
    public DateTime Time { get; set; }
    public string Type { get; set; }
}

The ReviewControl in the datatemplate had a DependencyProperty like so

public TagEvent ReviewEvent
    {
        get 
        {
            return (TagEvent)GetValue(ReviewEventProperty); 
        }
        set 
        {
            SetValue(ReviewEventProperty, value); 
        }
    }

    public static readonly DependencyProperty ReviewEventProperty = DependencyProperty.Register("ReviewEvent", typeof(TagEvent), typeof(ReviewControl), new PropertyMetadata(new TagEvent() { Comment = "hallo", Text = "De tag", Time = DateTime.Now, Type = "Mark", Value = "Mark" }, ReviewEvent_PropertyChangedCallback));

    private static void ReviewEvent_PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)  
    {
        ReviewControl reviewControl = (ReviewControl)d;
        reviewControl.LoadReviewEvent();
    }

The strange thing is that when I run my progran the TagEvents get added to the collection and the ItemsControl shows the datatemplate for every item. The testblock I used to verify the value of the properties on the TagEvents shows the proper value of the text property. But in the ReviewEvent Dependency property I get only “empty” objects (all values empty string or default date). Those objects replace the default value as i can see that as the oldvalue in the DP callback.

I could understand the ItemsControl not showing the items, but why it is showing item that look like it’s doing “new TagEvent” for every item in the collection is beyond me. Hope someone here has a suggestion for me. I tried implementing INotifyPropertyChanged on the TagEvent, but that did not seem to change anything. I could split out the properties of the TagEvent class but I don’t see why I would have to do that, when I could pass the object.

Help?

  • 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-23T01:22:20+00:00Added an answer on May 23, 2026 at 1:22 am

    I can now answer my own question. I had an statement setting the usercontrol’s datacontext in code-behind that I forgot about. It messed things up.

    Never leave old code laying about…

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

Sidebar

Related Questions

Alright let me explain my situation first: I am part of an organization that
Title might be a bit confusing, so let me explain. I have a website
Can PL/SQL procedure in Oracle know it's own name? Let me explain: CREATE OR
My question might not be understandable enough, so let me explain the situation :
Let me explain what we are doing: We have designed a frame of ir
Let me explain: this is path to this folder: > www.my_site.com/images And images are
First, let me explain what I am doing. I need to take an order,
Is it possible to wipe strings in Delphi? Let me explain: I am writing
This question might not seem programming related at first, but let me explain. I'm
How would you begin improving on a really bad system? Let me explain what

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.