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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:34:06+00:00 2026-06-05T07:34:06+00:00

I have a problem that is driving me crazy, I am working on a

  • 0

I have a problem that is driving me crazy, I am working on a project in WPF and I am creating a view.

I was designing a window which contains a “More Options” section, I had even been able to make this section show or hide. This section contained a tabControl which contained a TextBox as bellow:

<TabControl Margin="10,156,12,39" Name="moreTabControl" Grid.Column="1">
    <TabItem >
        <Grid>
            <TextBox Margin="6,6,8,28" Name="myTextBox"  />
        </Grid>
    </TabItem>
</TabControl>

So, in the code behind what I do to show or hide the “More Section” is as following:

public partial class FilterView : System.Windows.Window
{
    .....
    // Window's height when "more" option are showed
    private const int ShowMoreHeight = 386;

    /// Window's height when "more" option are hidden
    private const int ShowLessHeight = 186;

    private bool showMore = false;

    private void moreButton_Click(object sender, RoutedEventArgs e)
    {
        showMore = !showMore;
        ResizeWindow();
    }

     private void ResizeWindow()
    {
        if (showMore)
        {
            moreTabControl.Visibility = System.Windows.Visibility.Visible;
            moreButton.Content = "<< Less";
            MinHeight = ShowMoreHeight;
            Height = ShowMoreHeight;
        }
        else
        {
            moreTabControl.Visibility = System.Windows.Visibility.Collapsed;
            moreButton.Content = "More >>";
            MinHeight = ShowLessHeight;
            Height = ShowLessHeight;
        }
    }
......
.....
}

Everything went well until I needed to change the TextBox for a RichTextBox :(, when I run the program and press the “MoreButton” the “more” section is showed as expected but the container window grows a lot to the right!

And I only changed this: <TextBox Margin="6,6,8,28" Name="myTextBox" /> for this: <RichTextBox Margin="6,6,8,28" Name="myRichTextBox" />

Does anyone know what is happening??

Thank you in advance.

  • 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-05T07:34:07+00:00Added an answer on June 5, 2026 at 7:34 am

    I have solved my problem:

    Turns out that in my XAML code, my Window had a property called SizeToContent set to "WidthAndHeight", so I changed it to "Manual" and established a value for Width and Height manually.

    Hope this helps some else who is experiencing somethig similar.

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

Sidebar

Related Questions

Hey! Have a problem that is driving me crazy! My Main Window will not
I have the following problem in application express which is driving me crazy: I
I'm having a problem lately that's driving me crazy. I have a multi-dimensional array
I have a problem that's driving me crazy. I have a static class where
We have the problem that we have the open project files in our SVN
I have the problem that my view controller class has too many delegates and
I have a question that is driving me crazy. It is all about updating,
I'm running into a little problem that's driving me crazy, and I'd welcome any
I have an issue which is driving me crazy and as a last resort
I have a problem which has been driving me mad for days - I've

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.