Xamarin Forms: Label in the middle of the screen not displaying the full text content with multiple lines...












-1















If I'm trying to place a Label control which sits in the middle of the screen as per the below code, only one line in the Label is displayed, rest of the text with in the label is not displayed even with VerticalOptions="FillAndExpand"



<!-- StackLayout -->
<BoxView Style="{StaticResource separator}"></BoxView>
<StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand">
<Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
</StackLayout>
</StackLayout>
<BoxView Style="{StaticResource separator}"></BoxView>
<!-- StackLayout -->


Currently the UI is being displayed as below,



enter image description here



Here, I'm not seeing the full test "If you need to update your name please contact us and we can help with this request" being displayed



If I enable the VerticalOptions="FillAndExpand" to the root most element above the control and below as in the below code.



<BoxView Style="{StaticResource separator}"></BoxView>
<StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
</StackLayout>
</StackLayout>
<BoxView Style="{StaticResource separator}"></BoxView>


The UI comes up like below,



enter image description here



How to make sure that the control takes only the required space and displays the full content. Please let me know if one had faced a similar issue.










share|improve this question



























    -1















    If I'm trying to place a Label control which sits in the middle of the screen as per the below code, only one line in the Label is displayed, rest of the text with in the label is not displayed even with VerticalOptions="FillAndExpand"



    <!-- StackLayout -->
    <BoxView Style="{StaticResource separator}"></BoxView>
    <StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand">
    <Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
    <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
    <Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
    </StackLayout>
    </StackLayout>
    <BoxView Style="{StaticResource separator}"></BoxView>
    <!-- StackLayout -->


    Currently the UI is being displayed as below,



    enter image description here



    Here, I'm not seeing the full test "If you need to update your name please contact us and we can help with this request" being displayed



    If I enable the VerticalOptions="FillAndExpand" to the root most element above the control and below as in the below code.



    <BoxView Style="{StaticResource separator}"></BoxView>
    <StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    <Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
    <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
    <Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
    </StackLayout>
    </StackLayout>
    <BoxView Style="{StaticResource separator}"></BoxView>


    The UI comes up like below,



    enter image description here



    How to make sure that the control takes only the required space and displays the full content. Please let me know if one had faced a similar issue.










    share|improve this question

























      -1












      -1








      -1








      If I'm trying to place a Label control which sits in the middle of the screen as per the below code, only one line in the Label is displayed, rest of the text with in the label is not displayed even with VerticalOptions="FillAndExpand"



      <!-- StackLayout -->
      <BoxView Style="{StaticResource separator}"></BoxView>
      <StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand">
      <Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
      <Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      </StackLayout>
      </StackLayout>
      <BoxView Style="{StaticResource separator}"></BoxView>
      <!-- StackLayout -->


      Currently the UI is being displayed as below,



      enter image description here



      Here, I'm not seeing the full test "If you need to update your name please contact us and we can help with this request" being displayed



      If I enable the VerticalOptions="FillAndExpand" to the root most element above the control and below as in the below code.



      <BoxView Style="{StaticResource separator}"></BoxView>
      <StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
      <Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
      <Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      </StackLayout>
      </StackLayout>
      <BoxView Style="{StaticResource separator}"></BoxView>


      The UI comes up like below,



      enter image description here



      How to make sure that the control takes only the required space and displays the full content. Please let me know if one had faced a similar issue.










      share|improve this question














      If I'm trying to place a Label control which sits in the middle of the screen as per the below code, only one line in the Label is displayed, rest of the text with in the label is not displayed even with VerticalOptions="FillAndExpand"



      <!-- StackLayout -->
      <BoxView Style="{StaticResource separator}"></BoxView>
      <StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand">
      <Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
      <Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      </StackLayout>
      </StackLayout>
      <BoxView Style="{StaticResource separator}"></BoxView>
      <!-- StackLayout -->


      Currently the UI is being displayed as below,



      enter image description here



      Here, I'm not seeing the full test "If you need to update your name please contact us and we can help with this request" being displayed



      If I enable the VerticalOptions="FillAndExpand" to the root most element above the control and below as in the below code.



      <BoxView Style="{StaticResource separator}"></BoxView>
      <StackLayout Style="{StaticResource layoutSpacingPrimary}" BackgroundColor="#EFEFF4" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
      <Label Text="Looking to update your name?" Style="{StaticResource labelTitleBold}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
      <Label Text="If you need to update your name please contact us and we can help with this request" Style="{StaticResource labelTitle}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></Label>
      </StackLayout>
      </StackLayout>
      <BoxView Style="{StaticResource separator}"></BoxView>


      The UI comes up like below,



      enter image description here



      How to make sure that the control takes only the required space and displays the full content. Please let me know if one had faced a similar issue.







      xamarin.forms






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 18:21









      Aryan MAryan M

      657




      657
























          1 Answer
          1






          active

          oldest

          votes


















          0














          As explained in the docs:




          The number of lines displayed by a Label can be specified by setting the Label.MaxLines property to a int value:




          • When MaxLines is 0, the Label respects the value of the LineBreakMode property to either show just one line, possibly truncated, or all lines with all text.

          • When MaxLines is 1, the result is identical to setting the LineBreakMode property to NoWrap, HeadTruncation, MiddleTruncation, or TailTruncation. However, the Label will respect the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable.

          • When MaxLines is greater than 1, the Label will display up to the specified number of lines, while respecting the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable. However, setting the MaxLines property to a value greater than 1 has no effect if the LineBreakMode property is set to NoWrap.




          IDK what exactly do your styles but set LineBreakMode and MaxLines like this:



          <Label 
          Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate. Nullam porta eleifend lacinia. Donec at iaculis tellus."
          LineBreakMode="WordWrap"
          MaxLines="2" />


          And I think you should probably change your VerticalOptions="FillAndExpand" to VerticalOptions="StartAndExpand" for that part.



          HIH






          share|improve this answer























            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%2f53306528%2fxamarin-forms-label-in-the-middle-of-the-screen-not-displaying-the-full-text-co%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









            0














            As explained in the docs:




            The number of lines displayed by a Label can be specified by setting the Label.MaxLines property to a int value:




            • When MaxLines is 0, the Label respects the value of the LineBreakMode property to either show just one line, possibly truncated, or all lines with all text.

            • When MaxLines is 1, the result is identical to setting the LineBreakMode property to NoWrap, HeadTruncation, MiddleTruncation, or TailTruncation. However, the Label will respect the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable.

            • When MaxLines is greater than 1, the Label will display up to the specified number of lines, while respecting the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable. However, setting the MaxLines property to a value greater than 1 has no effect if the LineBreakMode property is set to NoWrap.




            IDK what exactly do your styles but set LineBreakMode and MaxLines like this:



            <Label 
            Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate. Nullam porta eleifend lacinia. Donec at iaculis tellus."
            LineBreakMode="WordWrap"
            MaxLines="2" />


            And I think you should probably change your VerticalOptions="FillAndExpand" to VerticalOptions="StartAndExpand" for that part.



            HIH






            share|improve this answer




























              0














              As explained in the docs:




              The number of lines displayed by a Label can be specified by setting the Label.MaxLines property to a int value:




              • When MaxLines is 0, the Label respects the value of the LineBreakMode property to either show just one line, possibly truncated, or all lines with all text.

              • When MaxLines is 1, the result is identical to setting the LineBreakMode property to NoWrap, HeadTruncation, MiddleTruncation, or TailTruncation. However, the Label will respect the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable.

              • When MaxLines is greater than 1, the Label will display up to the specified number of lines, while respecting the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable. However, setting the MaxLines property to a value greater than 1 has no effect if the LineBreakMode property is set to NoWrap.




              IDK what exactly do your styles but set LineBreakMode and MaxLines like this:



              <Label 
              Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate. Nullam porta eleifend lacinia. Donec at iaculis tellus."
              LineBreakMode="WordWrap"
              MaxLines="2" />


              And I think you should probably change your VerticalOptions="FillAndExpand" to VerticalOptions="StartAndExpand" for that part.



              HIH






              share|improve this answer


























                0












                0








                0







                As explained in the docs:




                The number of lines displayed by a Label can be specified by setting the Label.MaxLines property to a int value:




                • When MaxLines is 0, the Label respects the value of the LineBreakMode property to either show just one line, possibly truncated, or all lines with all text.

                • When MaxLines is 1, the result is identical to setting the LineBreakMode property to NoWrap, HeadTruncation, MiddleTruncation, or TailTruncation. However, the Label will respect the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable.

                • When MaxLines is greater than 1, the Label will display up to the specified number of lines, while respecting the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable. However, setting the MaxLines property to a value greater than 1 has no effect if the LineBreakMode property is set to NoWrap.




                IDK what exactly do your styles but set LineBreakMode and MaxLines like this:



                <Label 
                Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate. Nullam porta eleifend lacinia. Donec at iaculis tellus."
                LineBreakMode="WordWrap"
                MaxLines="2" />


                And I think you should probably change your VerticalOptions="FillAndExpand" to VerticalOptions="StartAndExpand" for that part.



                HIH






                share|improve this answer













                As explained in the docs:




                The number of lines displayed by a Label can be specified by setting the Label.MaxLines property to a int value:




                • When MaxLines is 0, the Label respects the value of the LineBreakMode property to either show just one line, possibly truncated, or all lines with all text.

                • When MaxLines is 1, the result is identical to setting the LineBreakMode property to NoWrap, HeadTruncation, MiddleTruncation, or TailTruncation. However, the Label will respect the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable.

                • When MaxLines is greater than 1, the Label will display up to the specified number of lines, while respecting the value of the LineBreakMode property with regard to placement of an ellipsis, if applicable. However, setting the MaxLines property to a value greater than 1 has no effect if the LineBreakMode property is set to NoWrap.




                IDK what exactly do your styles but set LineBreakMode and MaxLines like this:



                <Label 
                Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis nulla eu felis fringilla vulputate. Nullam porta eleifend lacinia. Donec at iaculis tellus."
                LineBreakMode="WordWrap"
                MaxLines="2" />


                And I think you should probably change your VerticalOptions="FillAndExpand" to VerticalOptions="StartAndExpand" for that part.



                HIH







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 19:03









                fmaccaronifmaccaroni

                2,3901824




                2,3901824
































                    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%2f53306528%2fxamarin-forms-label-in-the-middle-of-the-screen-not-displaying-the-full-text-co%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

                    Bressuire

                    Vorschmack

                    Quarantine