uwp page xaml size impact on TextBlock TextWrapping=“Wrap”










0















i'm trying to get uwp app's initial page size to take on a specific width and height leveraging to ensure wrapping as necessary of TextBlock content.



If I don't set Width and Height properties at Page or Grid container for StackPanel layout control of content then the behaves as i'd expect it in the event where I use grab handles on view edges and corners to resize it.



If I do set Width and Height properties at Page or Grid container for StackPanel layout control of content then the does not appear to work at all.



What is the right way to set the desired initial Width and Height for uwp app Page and have the child Grid/StackPanel/TextBlock[@TextWrapping="Wrap"] content behave as expected when outer window resizing events occur?










share|improve this question


























    0















    i'm trying to get uwp app's initial page size to take on a specific width and height leveraging to ensure wrapping as necessary of TextBlock content.



    If I don't set Width and Height properties at Page or Grid container for StackPanel layout control of content then the behaves as i'd expect it in the event where I use grab handles on view edges and corners to resize it.



    If I do set Width and Height properties at Page or Grid container for StackPanel layout control of content then the does not appear to work at all.



    What is the right way to set the desired initial Width and Height for uwp app Page and have the child Grid/StackPanel/TextBlock[@TextWrapping="Wrap"] content behave as expected when outer window resizing events occur?










    share|improve this question
























      0












      0








      0








      i'm trying to get uwp app's initial page size to take on a specific width and height leveraging to ensure wrapping as necessary of TextBlock content.



      If I don't set Width and Height properties at Page or Grid container for StackPanel layout control of content then the behaves as i'd expect it in the event where I use grab handles on view edges and corners to resize it.



      If I do set Width and Height properties at Page or Grid container for StackPanel layout control of content then the does not appear to work at all.



      What is the right way to set the desired initial Width and Height for uwp app Page and have the child Grid/StackPanel/TextBlock[@TextWrapping="Wrap"] content behave as expected when outer window resizing events occur?










      share|improve this question














      i'm trying to get uwp app's initial page size to take on a specific width and height leveraging to ensure wrapping as necessary of TextBlock content.



      If I don't set Width and Height properties at Page or Grid container for StackPanel layout control of content then the behaves as i'd expect it in the event where I use grab handles on view edges and corners to resize it.



      If I do set Width and Height properties at Page or Grid container for StackPanel layout control of content then the does not appear to work at all.



      What is the right way to set the desired initial Width and Height for uwp app Page and have the child Grid/StackPanel/TextBlock[@TextWrapping="Wrap"] content behave as expected when outer window resizing events occur?







      uwp height width textblock textwrapping






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 2:28









      myusrnmyusrn

      190215




      190215






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Ask far as I can see, what you mentioned is the right behavior. When you didn't define the size of your page or gird. The resize of your window makes your textblock also change it's size. As a result, the text in textblock will wrap according to your textblock. When you give grid or page a width, the stackpanel has to fit it's container so your textblock has a solid width, in this way, you cannot see wrap behavior any more.



          Have you tried to avoid using stackpanel and binding your textblock's width to a value which will change based on resizing? In that way it may works like you expected.(Which looks like a animation)






          share|improve this answer























          • I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

            – myusrn
            Nov 15 '18 at 14:27












          • On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

            – myusrn
            Nov 15 '18 at 14:30










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272911%2fuwp-page-xaml-size-impact-on-textblock-textwrapping-wrap%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Ask far as I can see, what you mentioned is the right behavior. When you didn't define the size of your page or gird. The resize of your window makes your textblock also change it's size. As a result, the text in textblock will wrap according to your textblock. When you give grid or page a width, the stackpanel has to fit it's container so your textblock has a solid width, in this way, you cannot see wrap behavior any more.



          Have you tried to avoid using stackpanel and binding your textblock's width to a value which will change based on resizing? In that way it may works like you expected.(Which looks like a animation)






          share|improve this answer























          • I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

            – myusrn
            Nov 15 '18 at 14:27












          • On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

            – myusrn
            Nov 15 '18 at 14:30















          1














          Ask far as I can see, what you mentioned is the right behavior. When you didn't define the size of your page or gird. The resize of your window makes your textblock also change it's size. As a result, the text in textblock will wrap according to your textblock. When you give grid or page a width, the stackpanel has to fit it's container so your textblock has a solid width, in this way, you cannot see wrap behavior any more.



          Have you tried to avoid using stackpanel and binding your textblock's width to a value which will change based on resizing? In that way it may works like you expected.(Which looks like a animation)






          share|improve this answer























          • I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

            – myusrn
            Nov 15 '18 at 14:27












          • On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

            – myusrn
            Nov 15 '18 at 14:30













          1












          1








          1







          Ask far as I can see, what you mentioned is the right behavior. When you didn't define the size of your page or gird. The resize of your window makes your textblock also change it's size. As a result, the text in textblock will wrap according to your textblock. When you give grid or page a width, the stackpanel has to fit it's container so your textblock has a solid width, in this way, you cannot see wrap behavior any more.



          Have you tried to avoid using stackpanel and binding your textblock's width to a value which will change based on resizing? In that way it may works like you expected.(Which looks like a animation)






          share|improve this answer













          Ask far as I can see, what you mentioned is the right behavior. When you didn't define the size of your page or gird. The resize of your window makes your textblock also change it's size. As a result, the text in textblock will wrap according to your textblock. When you give grid or page a width, the stackpanel has to fit it's container so your textblock has a solid width, in this way, you cannot see wrap behavior any more.



          Have you tried to avoid using stackpanel and binding your textblock's width to a value which will change based on resizing? In that way it may works like you expected.(Which looks like a animation)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 10:20









          Barry Wang - MSFTBarry Wang - MSFT

          7721311




          7721311












          • I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

            – myusrn
            Nov 15 '18 at 14:27












          • On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

            – myusrn
            Nov 15 '18 at 14:30

















          • I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

            – myusrn
            Nov 15 '18 at 14:27












          • On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

            – myusrn
            Nov 15 '18 at 14:30
















          I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

          – myusrn
          Nov 15 '18 at 14:27






          I have not tried what you suggest. even when I set initial width & height of either Page or root Grid container i'm still able to resize the uwp page view's window which led me to assume the child Grid/StackPanel/TextBlock UIElements would see those subsequent size changes similar to how html5/css3 <div style="display: flexbox"> behaves when browser window is resized.

          – myusrn
          Nov 15 '18 at 14:27














          On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

          – myusrn
          Nov 15 '18 at 14:30





          On a possibly related front i also tried putting <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> around the root Grid and when that didn't work around its child StackPanel to see if I could at least get scroll bars to navigate around to see StackPanel contained TextBlock content that goes out of view when it fails to wrap after I resize uwp page view's window and didn't get the horizontal and vertical scroll bars I was expecting.

          – myusrn
          Nov 15 '18 at 14:30

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53272911%2fuwp-page-xaml-size-impact-on-textblock-textwrapping-wrap%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo