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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:52:17+00:00 2026-06-15T18:52:17+00:00

I have a user control that contains only an image. This image is computed

  • 0

I have a user control that contains only an image. This image is computed in execution time. In behind there is a WritableBitMap where I do my ploting. Then the image.source is set to this WritableBitMap.
So my user control looks like:

public partial class ColorBrainMap : UserControl
{  
    //... some stuff
    //I load the base image from the resources
    BitmapImage tempImg = new BitmapImage();
    tempImg.BeginInit();
    tempImg.UriSource = new Uri("pack://application:,,,/ColorBrainMap;component/imgs/brain.png");
    tempImg.EndInit();

    //I copy the image into a WritableBitMap for convenience
    WriteableBitmap baseImage = new WriteableBitmap(tempImg);
    //I do some plotting over the base image
    //and set the final result as a source for the image
    image.Source = baseImage;
 }

In the other side my xaml is extremelly simple:

<Grid>
        <Image HorizontalAlignment="Stretch" Name="image" Stretch="Fill" VerticalAlignment="Stretch"/>
</Grid>

The I create my new project. I add the component as a reference and drop a new instance into my xaml so it looks like that:

<Window x:Class bla bla 
    Height="396" Width="541" 
    xmlns:my="clr-namespace:ColorBrainMapTOOL;assembly=ColorBrainMap">
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="300*" />
        <ColumnDefinition Width="219*" />
      </Grid.ColumnDefinitions>
      <my:ColorBrainMap HorizontalAlignment="Stretch" Name="brainMap" VerticalAlignment="Stretch" />
      <!-- some other components in the other column of the grid-->
      </Grid>
</Window>

The whole thing works nicelly until I try to resize it. The control itself resizes (I tested it adding some background and border and the whole thing moves nicelly) but not the image. The image recalculates the plot on demand and works nice but it get stuck to it initial size.

Any clue of how to do it without resizing the internal images and recalculating the plots and all that work again ??

  • 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-15T18:52:19+00:00Added an answer on June 15, 2026 at 6:52 pm

    I think you can use a ViewBox and set your Image or the ColorBrainMap to be its Child;

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

Sidebar

Related Questions

I have a WPF User Control that really contains only a template expander. And
I have a user control that contains a collection of controls to be reused
I have a user control that contains a GridView. The GridView has both a
I have a user control that contains multiple controls (CheckBox, Button, Label...). I want
Another WPF question for you all. I have a user control that contains a
I have a Web User Control that contains a CheckBoxList. MyListControl: <asp:checkboxlist id=chkList runat=server>
I have written a user control that contains a text box and a button.
Please advise me. Winforms app, C#. I have a user control (UC) that contains
I have a page that contains a user control that is just a personalized
I have an ASP.NET user control that contains a text box control and a

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.