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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:11:28+00:00 2026-05-24T22:11:28+00:00

I am trying to mimic the Sticky Notes application in Windows 7. In the

  • 0

I am trying to mimic the Sticky Notes application in Windows 7. In the original application, if you type text into a Sticky Note and the text becomes too large (vertically, as in number of lines) to fit in the window, the window automatically expands vertically, one line at a time, to allow for more room. In other words, where in a normal Textbox a vertical scrollbar would appear and the text would scroll down (so that the first line becomes invisible), in the Sticky Notes the textbox expands exactly enough to fit the text so that no scrollbar appears. The scrollbar still appears when you manually resize the window afterwards, of course.

If you have Windows 7 just open the Sticky Notes application and type a few lines in the sticky note until it enlarges.

I am trying to mimic this effect but I’m having no luck. The problem seems that the actual Window should resize, not just the Textbox (I don’t think WPF works this way, that a resize of a child element can ‘force’ the parent element to become larger? At least not for a Window, right?).

The contents of the Window at this point are such:

<Window Background="Transparent" BorderBrush="Transparent"> 
    <!-- Transparent border to draw dropshadow on -->
    <Border Background="Transparent" BorderBrush="Transparent">
        <!-- Grid with UI elements -->
        <Grid Margin="5" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="27" />       
                <RowDefinition Height="*" />
            </Grid.RowDefinitions> 

            <!-- Stickynote header -->
            <Border ... />

            <!-- Content -->
            <Border Grid.Row="1">

                <TextBox Text="{Binding ContentText}" ... />

            </Border>
        </Grid>
    </Border>
</Window>

Does anybody know how I can achieve this effect? Thanks!

  • 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-24T22:11:28+00:00Added an answer on May 24, 2026 at 10:11 pm

    Try the Window Property SizeToContent="Height"

    Sample

    <Window ...
            MaxHeight="500"
            SizeToContent="Height">
        <Border Background="Transparent" BorderBrush="Transparent">
            <Grid Margin="5" Background="Transparent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="27" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Border Grid.Row="1">
                    <TextBox AcceptsReturn="True" MinHeight="100"/>
                </Border>
            </Grid>
        </Border>
    </Window>
    

    Edit
    To use it with the TransparentWindow you posted, add transparentWindow.SizeToContent = SizeToContent.Manual in OnDragDelta (TransparentWindow.cs)

    private static void OnDragDelta(object sender, DragDeltaEventArgs e)
    {
        TransparentWindow transparentWindow = (TransparentWindow)sender;
        Thumb thumb = e.OriginalSource as Thumb;
        transparentWindow.SizeToContent = SizeToContent.Manual;
        if (thumb != null && transparentWindow.WindowState == WindowState.Normal)
        {
            //...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a MySQL-based application support MS SQL, I ran into the following
I'm developing a Qt application. For each class, I'm trying to mimic the framework,
I am trying to mimic the behavior of, for example, Windows Explorer and how
I'm trying to mimic the behaviour of the HTC SMS application (tradional view), where
I have javascript code that i am trying to mimic in an android application:
I'm trying to mimic the following Java code: int[][] multi; // DIMENSIONS ARE UNKNOWN
I'm trying to mimic what every other tabular view does with the DataGridView control,
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
I'm trying to mimic the Camera app transition from the front to back camera..

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.