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

The Archive Base Latest Questions

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

i have a wpf window where i have a stackpanel with two viewports in

  • 0

i have a wpf window where i have a stackpanel with two viewports in it – each Viewport with a textblock in it.

<Grid>
    <StackPanel VerticalAlignment="Center" Orientation="Vertical" >
        <Viewbox Margin="100,0,100,0">
            <TextBlock x:Name="headerText" 
                       Text="Lorem ipsum dolor" 
                       Foreground="Black"/>
        </Viewbox>
        <Viewbox Margin="150,0,150,0">
            <TextBlock x:Name="subHeaderText" 
                       Text="Lorem ipsum dolor, Lorem ipsum dolor, lorem isum dolor, Lorem ipsum dolor, Lorem ipsum dolor, lorem isum dolor, " 
                       TextWrapping="Wrap" 
                       Foreground="Gray" />
        </Viewbox>
    </StackPanel>
</Grid>

What i would like to achieve is that the top textblock is the heading with a bigger text. The second textblock is the sub heading with a smaller text. No matter how much text there is for either the heading or the subheading the font should dynamic become smaller/bigger. My problem is that i would like the subheading to be fixed width. This means that, the font should be a percentage (70%) of the heading and wrap to multiple lines, depending on how much text i have. I enclosed the code I have thus far… im missing something with that subheading, cant figure out what. Cheers

Edit
Basically what i want achieve is that the sub header wraps the text so it can expand it downwards with the font being a 70% of the heading – no matter how big that font is.

  • 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:10:25+00:00Added an answer on May 25, 2026 at 2:10 pm

    Nesting a stackpanel will cause the textbox to wrap properly:

    <Viewbox Margin="120,0,120,0">
        <StackPanel Orientation="Vertical" Width="400">
            <TextBlock x:Name="subHeaderText" 
                       FontSize="20" 
                       TextWrapping="Wrap" 
                       Foreground="Black"
                       Text="Lorem ipsum dolor, lorem isum dolor,Lorem ipsum dolor sit amet, lorem ipsum dolor sit amet " />
        </StackPanel>
    </Viewbox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one has me beat; I have a WPF window with two (important for
I have a WPF Window with a grid: <Grid Name=mainGrid> <Grid.ColumnDefinitions> <ColumnDefinition Width=20* />
I have a WPF Window which has a among other controls hosts a Frame.
I have a WPF window for editing database information, which is represented using an
I have a WPF window, which contains a button called Cancel. Under ordinary circumstances
So if I have a WPF window, would moving another window over the WPF
Is it possible to have a WPF window/element detect the drag'n'dropping of a file
I'm new to WPF. I have a WPF Window with a bunch of Labels
I have a ListBox in my wpf window that binds to an ObervableCollection .
I've got a WPF window where I have a column of buttons on the

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.