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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:18:55+00:00 2026-05-26T13:18:55+00:00

I have a ListView-derived class which creates a bunch of user controls that are

  • 0

I have a ListView-derived class which creates a bunch of user controls that are Panel-derived classes that contain a few controls each, most importantly a Image control (m_labelIcon). I am setting the image source for this control dynamically to one of the PNGs in my resource:

Uri uri = new Uri("/MyApp;component/Common/Main/res/drawable/some_icon.png");
StreamResourceInfo resourceInfo = Application.GetResourceStream(uri);
BitmapImage bitmapSource = new BitmapImage();

bitmapSource.CreateOptions = BitmapCreateOptions.None;

bitmapSource.SetSource(resourceInfo.Stream);
m_labelIcon.Source = bitmapSource;

However, when the list view appears, the images are all missing. If I scroll the list to the very bottom and then back to the top, the images start appearing. I’ve specified BitmapCreateOptions.None, which should prevent delay-loading the images (they are in my resource and not on the web).

I’ve also tried using the ImageOpened event, but this doesn’t work.

Any thoughts?

Thanks,
swine

  • 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-26T13:18:56+00:00Added an answer on May 26, 2026 at 1:18 pm

    After hours of the debugging, I stumbled upon the simple solution. Even though I was overriding ArrangeOverride() and MeasureOverride() like so:

    protected override Size MeasureOverride(Size availableSize)
    {
      Size panelDesiredSize = new Size();
    
      double height = Math.Max(getIconSizeToUseInPixels(),
        m_labelName.DesiredSize.Height);
    
      panelDesiredSize = new Size(availableSize.Width, height);
    
      return panelDesiredSize;
    }
    
    protected override Size ArrangeOverride(Size finalSize)
    {
      double x = 0;
      double y = 0;
    
      m_labelName.Measure(finalSize);
    
      double iconWidth = getIconSizeToUseInPixels();
      Size iconSize = new Size(iconWidth, iconWidth);
    
      double nameWidth = m_labelName.DesiredSize.Width;
      double nameHeight = m_labelName.DesiredSize.Height;
    
      m_labelIcon.Arrange(new Rect(
        new Point(x, y), iconSize));
    
      m_labelName.Arrange(new Rect(
        new Point(iconWidth, y + (finalSize.Height - nameHeight) / 2),
        new Size(nameWidth, nameHeight)));
      m_labelName.Width = nameWidth;
      m_labelName.Height = nameHeight;
    
      return finalSize; // Returns the final Arranged size
    }
    

    I still needed to set the Width and the Height properties of the Image control manually in the constructor of my custom control like so:

    THIS FIXED THE PROBLEM:

      m_labelIcon.Width = getIconSizeToUseInPixels();
      m_labelIcon.Height = getIconSizeToUseInPixels();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, so, I have a ListView-derived control that changes Grouping and ItemsSource on the
I have a listview which I would like to fill with self created user
I have 2 ways of displaying ListView data. I have a class for each
I have listView in which I inflate a row contain textview and button now
I have a ListView with a bunch of ListItem's. When the user selects an
I have listview that contain checkbox and an image when the checkbox is clikced
I have ListView which as one TextView in each Row. and im discovering some
I have ListView , which displays records (movies) from the SQLite DB. Each record
I would have listview and a lot of items inside. I want that user
I have a custom control that is derived from ListView . This list view

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.