locked
Xaml code + design bug : Blend for VS 2012 RC, Metro app, xaml + c# RRS feed

  • Question

  • <TextBox HorizontalAlignment="Left" Margin="16,169.5,0,0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="21.333" Height="388" Width="558" Text="Trusted People and Solutions&#xD;&#xA;&#xD;&#xA;Our e-business solutions are designed to optimize your business processes and support your organization as it grows. &#xD;&#xA; Our consultants work to ensure that your needs are satisfied, your deadlines are met, and your budget is respected."/>

    This xaml is not working well when you change Wrap to NoWrap in xaml code, all the text after Solutions is lost visually and in the Text property of Blend but the xaml remains the same.

    • Edited by GearWorld Wednesday, August 1, 2012 9:37 AM
    Wednesday, August 1, 2012 9:37 AM

Answers

  • Ok , [what a nice video tool by the way]

    ---

    I can reproduce all the steps you have demonstrated. The lessons are in a nutshell:

    1.- Wrap and AcceptsReturn=True is what you probably need for your application

    2.- Some of the other combinations are producing a result at run-time, that is not always consistent with the documentation (see above)

    3.- Finally, you identified a bug that I could indeed reproduce: switching from NoWrap to Wrap requires you to fiddle with the text in order to restore the text that follows  "Trusted People and Solutions"

    4.- Your video will be invaluable in detecting any bug thereabout in Blend.

    ---


    • Edited by ForInfo Wednesday, August 1, 2012 2:31 PM
    • Marked as answer by GearWorld Wednesday, August 1, 2012 3:39 PM
    Wednesday, August 1, 2012 2:26 PM

All replies

  • If you cut the entire xaml and make it so the designer remove the control then paste the xaml again, the text comes back !

    Wednesday, August 1, 2012 9:40 AM
  • I enabled AcceptsReturn and it seems a bit better however if I run the app, the text is still cut no regards if it's Wrap or NoWrap, everything after Solutions is lost when running the app however in Blend everything is there xaml code and visually.


    • Edited by GearWorld Wednesday, August 1, 2012 9:48 AM
    Wednesday, August 1, 2012 9:47 AM
  • "everything after Solutions is lost when running the app "

    I pasted your code and ran the following with success in the simulator:

    <Page
        x:Class="App9.MainPage"
        IsTabStop="false"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App9"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <TextBox HorizontalAlignment="Left" Margin="16,169.5,0,0" VerticalAlignment="Top" TextWrapping="Wrap" 
             FontSize="21.333" Height="388" Width="558" AcceptsReturn="False/True"
             Text="Trusted People and Solutions&#xD;&#xA;&#xD;&#xA;Our e-business solutions are designed to optimize your business processes and support your organization as it grows. &#xD;&#xA; Our consultants work to ensure that your needs are satisfied, your deadlines are met, and your budget is respected."
             />
        </Grid>
    </Page>

    ---
    Couple of remarks:

    - Setting 'Wrap' and 'AcceptsReturn=true' is a probably the best option for your use case.
    - Setting AcceptsReturn 'False' precludes the user from updating the text and using 'Return' as one would expect.
    - Setting AcceptsReturn 'True' lets the TextBox accept that keystroke
    ---
    However, in the case of AcceptsReturn 'False', your example demonstrated a discrepancy between the TextBox behavior and the TextBox documentation(*): the system takes into account the 'Return' [&#xD;&#xA;] from your initial TextBox.Text value and this contradicts the documentation as it is presently formulated.

    --

    (*)

        // Summary:
        //     Represents a control that can be used to display single-format, multi-line
        //     text.
        [MarshalingBehavior(MarshalingType.Agile)]
        [Threading(ThreadingModel.Both)]
        [Version(100794368)]
        [WebHostHidden]
        public class TextBox : Control
        {
            // Summary:
            //     Initializes a new instance of the TextBox class.
            public TextBox();
    
            // Summary:
            //     Gets or sets the value that determines whether the text box allows and displays
            //     the newline or return characters.
            //
            // Returns:
            //     True if the text box allows newline characters; otherwise, false. The default
            //     is false.
            public bool AcceptsReturn { get; set; }
    

     

    Wednesday, August 1, 2012 1:06 PM
  • Well I don't know if we have the same version but mine doesn't work.  As soon as I just slightly change a value in xaml code when in Split mode for instance, the designer is losing everything after Solutions.

    I just tried again.

    Here's a screenshot : Blend Designer Error...

    Blend Version 5.0.30514.0

    • Edited by GearWorld Wednesday, August 1, 2012 1:25 PM
    Wednesday, August 1, 2012 1:22 PM
  • Again if I don't change anything and let this as is.  If I run the app, the text is lost anyway...
    Wednesday, August 1, 2012 1:26 PM
  • Here's a small video showing the behavior in action : Demo

    See how the visual in the designer do not update according to the action I do with Wrapping and AcceptsReturn as I have to change the last ; followed by the next Character in order to finally see in the designer what is going on

    Wednesday, August 1, 2012 2:03 PM
  • This is most unfortunate. Here is my sequence:

    - started Blend (same version by the way) from the Start screen

    - chose New project

    - selected Split Mode

    - on line 12, copied and pasted from a Notepad text (to make sure no ancillary - hidden - characters were present) the XAML (*) hereafter

    - ran successfully

    - entered different characters in the Text, entered even 'Return' keystrokes, ... the complete text was always displayed and never cut as your snapshot shows.

    ---

    (*)

    <TextBox HorizontalAlignment="Left" Margin="16,169.5,0,0" VerticalAlignment="Top" TextWrapping="Wrap" 
             FontSize="21.333" Height="388" Width="558" AcceptsReturn="True"
             Text="Trusted People and Solutions&#xD;&#xA;&#xD;&#xA;Our e-business solutions are designed to optimize your business processes and support your organization as it grows. &#xD;&#xA; Our consultants work to ensure that your needs are satisfied, your deadlines are met, and your budget is respected."
             />

     

     

    Wednesday, August 1, 2012 2:03 PM
  • Ops I just wrote before you.  See my last message :)
    The behavior I'm looking here isn't right
    • Edited by GearWorld Wednesday, August 1, 2012 2:05 PM
    Wednesday, August 1, 2012 2:05 PM
  • Ok , [what a nice video tool by the way]

    ---

    I can reproduce all the steps you have demonstrated. The lessons are in a nutshell:

    1.- Wrap and AcceptsReturn=True is what you probably need for your application

    2.- Some of the other combinations are producing a result at run-time, that is not always consistent with the documentation (see above)

    3.- Finally, you identified a bug that I could indeed reproduce: switching from NoWrap to Wrap requires you to fiddle with the text in order to restore the text that follows  "Trusted People and Solutions"

    4.- Your video will be invaluable in detecting any bug thereabout in Blend.

    ---


    • Edited by ForInfo Wednesday, August 1, 2012 2:31 PM
    • Marked as answer by GearWorld Wednesday, August 1, 2012 3:39 PM
    Wednesday, August 1, 2012 2:26 PM
  • Thanks to VideoLightBox
    Also I bought AVSVideoEditor which include a better Screen Capture than Expression Encoder Screen Capture sorry MS.

    Count on me to use it again if I encounter any other problems.
    Your help is very appreciated.

    Thank you



    • Edited by GearWorld Wednesday, August 1, 2012 3:42 PM
    Wednesday, August 1, 2012 3:38 PM