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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:39:45+00:00 2026-06-17T11:39:45+00:00

I have a problem, with my WPF application. I’m trying to databind an image

  • 0

I have a problem, with my WPF application.
I’m trying to databind an image field, in my gridview, with the image property from my viewmodel.

<DataGridTemplateColumn Header="Image" IsReadOnly="True">
    <DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
        <Image Source="{Binding Path=Image, IsAsync=True}" />
    </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

This is no problem, if I don’t use IsAsync.
However, I would like to do it async, as it’s a lot of images to load, and it needs to load them from a webservice.

The code for the Image property is this, which just calls a handler dll, that calls a webservice.

    public BitmapSource Image
    {
        get { return image ?? (image = ImageHandler.GetDefaultImages(new[] {ItemNumber},160,160)[0].BitmapSource()); }
    }

But, as soon as I add the IsAsync=true, I get the following exception, once the form has loaded:

The calling thread cannot access this object because a different thread owns it.

I am quite new to WPF, and I kind of assumed, that it handled the threading itself, when async was set to true. Do I need to somehow invoke, in the databinding?
If so, how on earth do I do this?

  • 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-17T11:39:46+00:00Added an answer on June 17, 2026 at 11:39 am

    IsAsync means that the bound property will be accessed from another thread, so make sure that whatever you’re creating can then be used in a cross-thread manner. The final step of the binding will always occur on the main thread.

    Almost all classes in WPF inherit from DispatcherObject, which basically ‘links’ an object to the current thread when it’s created. The BitmapSource in your code is created on another thread and then cannot be used on the main UI thread.

    However, BitmapSource inherits from Freezable: simply call the Freeze method on your BitmapSource before returning, to make it immutable and usable from any thread.

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

Sidebar

Related Questions

I have a problem with my WPF application. I have a datagrid (Wpf Toolkit),
I have a problem with XamDataChart in a WPF application. When I add the
While debugging a problem in a WPF application, I have noticed that the TwoWay
I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and
i have a problem i make a wpf application its running well.but i want
I have discovered a strange bug with my WPF application and I am trying
I have a problem with WPF triggers. In my application i used a multitrigger
I have a WPF application that mostly follows MVVM, which I am trying to
I have a WPF application that I'm trying to dynamically add items to a
I want my WPF application run just one time. I have no problem with

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.