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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:10:51+00:00 2026-05-28T11:10:51+00:00

I currently write an image viewer control that encapsulates a WPF Image Control and

  • 0

I currently write an image viewer control that encapsulates a WPF Image Control and further stuff (Controls for applying filters and changing views). Here’s the relevant portion of control’s source code:

public partial class ImageViewPort : UserControl, INotifyPropertyChanged
{
    private BitmapSource _source;

    public static readonly DependencyProperty ImageDescriptorSourceProperty =
        DependencyProperty.Register("ImageDescriptorSource",
                                 typeof(ImageDescriptor),
                                 typeof(ImageViewPort),
                                 new UIPropertyMetadata(ImageDescriptorSourceChanged));

    public ImageDescriptor ImageDescriptorSource
    {
        get { return (ImageDescriptor)GetValue(ImageDescriptorSourceProperty); }
        set { SetValue(ImageDescriptorSourceProperty, value); }
    }

    public BitmapSource Source //the image control binds to this beauty!
    {
        get { return _source; }
        set { _source = value; OnPropertyChanged("Source"); }
    }

   public ImageViewPort() { InitializeComponent(); }

    private static void ImageDescriptorSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        ImageViewPort viewPort = (ImageViewPort)d;
        if (viewPort != null)
        {
            viewPort.TransformImage();
        }
    }

    private BitmapSource TransformImage()
    {
        //do something that sets the "Source" property to a BitmapSource
    }
}

The XAML Code (only relevant parts) of the user control:

<UserControl x:Name="viewPort">
<Image Source="{Binding ElementName=viewPort,Path=Source}"/>
</UserControl>

And finally the usage:

<WPF:ImageViewPort ImageDescriptorSource="{Binding Path=CurrentImage}"/>

In my window, I basically iterate a Collection and, as I do so, throw PropertyChanged notification for the CurrentImage property. That works, the getter is called each time, so the binding seems to work.

What I would expect to happen now is that the PropertyChanged-Callback of my UserControl is fired, but no such thing happens (It never steps in there, I’ve tried using breakpoints). I’ve tried the same thing binding a primitive type (int), and that worked.

Do you see any flaw in my implementation? Why isn’t the user control updating?
Thanks a lot in advance for any help!

Cheers

Sebi

  • 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-28T11:10:51+00:00Added an answer on May 28, 2026 at 11:10 am

    Check the output … do you get any binding warnings? Also are you setting a new value? WPF knows when you try to set a value that is already set and ignores it. I would suggest thange the Metadata type to FrameworkPropertyMetadata and supply a proper default value.

    To give this “comment” more value: Adding “PresentationTraceSources.TraceLevel=High” on the binding gives alot more information about how the binding tries to get its value, which also helps alot, finding problems that are not errors for WPF.

    <TextBox Text="{Binding MyText, PresentationTraceSources.TraceLevel=High}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to write an addin for PowerPoint that whenever any PowerPoint
I am currently trying to write an application that displays live video from a
I'm currently learning how to write a WPF application using the MVVM pattern. I'm
I am currently write a html page for uploading image, once the image gets
I am currently trying to write functional tests for a charging form which gets
I'm currently tempted to write the following: public class Class1() { public Class1() {
Currently I'm trying to write my first Python library and I've encountered the following
currently I am trying to write to an 20x4 LCD Dot-Matrix Module using Perle's
Currently I have to write the following to update an element already contained in
I'm currently on my way to write a web application implementing the MVC and

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.