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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:45:14+00:00 2026-05-25T14:45:14+00:00

I have an Image control, generated in runtime. It renders correct size when displaying.

  • 0

I have an Image control, generated in runtime. It renders correct size when displaying. But I can’t get size of that element. Width and Height is NaN. ActualWidth and ActualHeight is always 0.0 and control never fires SizeChanged event.

enter image description here

I’m also generating TextBoxes in the runtime and I can’t get size of them too.

The code that generates image is bellow.

ExtendedImage image = new ExtendedImage();
image.Name = "element" + item.Id;
if (item.Text.ToUpperInvariant().EndsWith(".GIF"))
{
    var gif = BookReader.Imaging.GIFDecoder.Decode(Application.GetResourceStream(new Uri("Files/Books/" + item.BookId + "/" + item.Text, UriKind.Relative)).Stream);
    image.Source = gif.Frames[0].Image;
}
else
{
    var img = new BitmapImage(new Uri("/Files/Books/" + item.BookId + "/" + item.Text, UriKind.Relative));
    image.Source = img;
}

image.SetValue(Canvas.LeftProperty, (double)item.LocationX);
image.SetValue(Canvas.TopProperty, (double)(Application.Current.Host.Content.ActualHeight - item.LocationY));

image.SizeChanged += (o, e) =>
{
    var sender = o as ExtendedImage;
    image.SetValue(UIElement.RenderTransformOriginProperty, new Point(0.5, 0.5));
};

image.InvalidateMeasure();

if (!item.Visible)
{
    image.Visibility = System.Windows.Visibility.Collapsed;
}

ContentPanel.Children.Add(image);
  • 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-25T14:45:15+00:00Added an answer on May 25, 2026 at 2:45 pm

    If the container of the Image has Height and Width, the image should have it as well. Try to put your Image into a Grid or StackPanel and set the size explicitly.

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

Sidebar

Related Questions

I have got an ActiveX Control that gets an image from a fingerprint device
I have a simple Button control that contains an Image object as its content.
I have a style for an items control that binds to an image in
I have a UIScrollView that contains an image and a segmented control that allows
How can I DataBind my Image control to automatically get the player.PlayerImage updates? As
I have one image website where users can vote images. IMAGES ARE RANDOMLY GENERATED
I have a class that accepts a Control and draws generated images to it.
I have an Image control in my Flex application: <mx:Image id=img source=@Embed('img.png') percentHeight=100 percentWidth=100
I have an image control with a source image located in my c drive.
I have a asp image control. ImageUrl=images/avator.jpg. I'm changing this picture on the server

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.