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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:22:21+00:00 2026-06-15T03:22:21+00:00

I have a custom class (to simplify stuff, I have stripped down the codes):

  • 0

I have a custom class (to simplify stuff, I have stripped down the codes):

public class AlbumItem
{
   public StorageFile AlbumThumbnail { get; set;}
}

When I bind this to a ListView:

<ListView.ItemTemplate>
            <DataTemplate>
                <Grid Height="100" Background="#FFabe372">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="80" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Image Source="{Binding AlbumSource}" Margin="10" Stretch="Uniform"></Image>
                    <TextBlock Margin="20 5" Grid.Column="1" Style="{StaticResource  AlbumListViewItemStyle}" Text="{Binding AlbumDisplayText}"></TextBlock>
                </Grid>

            </DataTemplate>
</ListView.ItemTemplate>

The Image‘s source is set to AlbumSource, as I have thought to implement AlbumSource as a Get-only property:

public class AlbumItem
{
   public StorageFile AlbumThumbnail { get; set;}

   public BitmapImage AlbumSource
   {
       get
       {
          BitmapImage bmp = new BitmapImage();
          bmp.SetSource(await AlbumThumbnail.OpenReadAsync());
          return bmp;
       }
   }
}

As expected I can’t use the await keyword in the accessor method, at the same time I cannot declare a property stub as an async method.

Can somebody point me in the correct direction? I may be trying a Converter later. Thanks!

  • 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-15T03:22:23+00:00Added an answer on June 15, 2026 at 3:22 am

    IMHO property accessors should always return almost immediately. Long running operations should not execute inside a property accessor as this can have significant perfromance impacts because of the widely held assumption that an accessor is basically a variable read operation (i.e. properties can be accessed a lot, in loops, not cached for subsequent access etc).

    I’d do something like this:

    private async Task SetAlbumSourceAsync()
    {
        bmp = new BitmapImage();
        var source = await AlbumThumbnail.OpenReadAsync();
        bmp.SetSource(source);
        RaisePropertyChanged("AlbumSource");
    }
    
    BitmapImage bmp;
    public BitmapImage AlbumSource
    {
        get
        {
            if (bmp == null) // might need a better sync mechanism to prevent reentrancy but you get the idea
                SetAlbumSourceAsync();
    
            return bmp;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom class: public class Person { public String Name { get;
Bit of a noob question but: I have a custom class defined as: public
I have my custom class User : class User { public String name; public
I have a custom class called card and I need to create a set
I have custom class like the below; Public MyClass Public Property MyText() As String
I have a custom class class RouteStop { public int number; public string location;
I have a custom class ButtonImage . public ButtonImage(Activity activity) { face1 = activity.getResources().getIdentifier(face1,
I have a custom class Contact . I am trying to bind a List<Contact>
I have Custom UIView class in one textview. Custom View class frame set only
I have custom app class public class MyApp extends Application { public static Context

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.