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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:11:11+00:00 2026-05-11T16:11:11+00:00

What I am trying to do is show a window, that does not explicitly

  • 0

What I am trying to do is show a window, that does not explicitly have a height/width, (both values omitted or set to Auto).
I was guessing that the window would find out its size by auto – calculating all contained usercontrols sizes, but this doesn’t actually work!

Instead I get a big window with Actualwidth and Actualheight values both set to 512 (?!?!)

Window declaration:

<Window x:Class="Window3"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Window3" 
  Height="Auto">
<StackPanel>
    <Label>Window</Label>
</StackPanel>
</Window>

Showing this window as a dialog via:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button2.Click
    Dim dlg As New Window3
    dlg.ShowDialog()
End Sub

Is there a solution for this?
I don’t want to explicitly set the size of my window because many controls in the form will be collapsed based on constructor parameters, and trying to find the actual size of the form would be tricky (and ugly).

  • 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-11T16:11:11+00:00Added an answer on May 11, 2026 at 4:11 pm

    Set the window’s property SizeToContent="WidthAndHeight". This should help.

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

Sidebar

Related Questions

I'm trying to show/hide a movieclip (or graphic) symbol that is on a layer
I am trying to set a flag to show or hide a page element,
I am trying to create a recordset in Access VBA that will show me
I want to pop up a window to show that a program is busy
i'm trying to do video windowing that is: show all frames from a video
I have an existing web application which uses window.showmodaldialog() to show certain forms and
I'm trying to show someone a use for interfaces in a crazy situation they've
I'm trying to show a custom hint in a TWinControl but I can't figure
I am trying to show and hide an inline element (eg a span) using
I am really trying to show what htmlentities gives me, but it doesn't give

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.