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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:44:39+00:00 2026-06-07T23:44:39+00:00

I’ve got a dependency object that defines a single depedendency property named Renderer. public

  • 0

I’ve got a dependency object that defines a single depedendency property named “Renderer”.

public class Renderer {
  public string ResourceKey{get; set;}
  public string[] Params{get; set;}
}

public class CellInfo : DependencyObject {
  public static readonly DependencyProperty RendererProperty=
  DependencyProperty.Register("Renderer", typeof(Renderer), typeof(CellInfo), null);

  public Renderer Renderer {
    get { return (Renderer)GetValue(RendererProperty); }
    set { SetValue(RendererProperty, value); }
  }

  public void UpdateRenderer(string resourceKey, params string[] parameters) {
    this.Renderer.ResourceKey = resourceKey;
    this.Renderer.Params = parameters;
    //force refresh - this does not work
    Renderer tmp = this.Renderer;
    this.Renderer = null;
    this.Renderer = tmp;
  }
}

In XAML I’m declaring it like this:

<local: CellInfo x:key="cellInfo" />

And further down I bind to it as such:

 <ControlTemplate x:Key="MyDisplayTemplate" >
    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Stretch"  >
  <TextBlock.Text>
    <MultiBinding Converter="{StaticResource MyConverter}" >
      <Binding Path="Value" />
      <Binding Source="{StaticResource cellInfo}" Path="Renderer"/>
    </MultiBinding>
  </TextBlock.Text>
    </TextBlock>
</ControlTemplate>

The above control template is used as the display template for cells of a grid. I want to use dependency objects/properties here for performance reason, given that they do have a performance and memory resource edge over implementing INotifyPropertyChanged
as I understand it.

The problem I’m having is getting an update to trigger for the cells when data for Renderer object is changed. In code I’m attempting to get around the fact that Dependency properties will not trigger updates if the value is the same by first setting to setting to null, then setting back to the original property value. This does not work.

The only thing I have been able to get to work is to also have the object implement INotifyPropertyChanged and firing the PropertyChanged event in CellInfo.Renderer setter.

My guess is having to implement INotifyPropertyChange negates the performance benefit of using only DependencyObjects, is that correct? At this point, if I’m forced to implement INotifyPropertyChanged, I might as well not even extend DependencyObject, correct?

Thanks for any input.

  • 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-07T23:44:41+00:00Added an answer on June 7, 2026 at 11:44 pm

    Either swap out an instance of Renderer instead of modifying the existing instance (thus you may as well make it immutable), or have it extend DependencyObject and expose dependency properties.

    The reason setting the property to null and back again isn’t working is because WPF never gets a chance to “see” the property as null. Your code is running in a dispatcher message and binding updates will occur in a separate message. Since, that message doesn’t run until after yours, it never sees the change. There is a workaround here, which is to update to null in one message, and then set it back again in another. But then you’re throwing all performance gains well and truly out the window. Not to mention that doing it the “right” way turns out to be much easier anyway.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
i got an object with contents of html markup in it, for example: string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.