SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Code formating in WPF project

Last post 08-28-2017 6:12 PM by sbridewell. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-28-2017 11:21 AM

    Code formating in WPF project

    Hello everyone,

    Currently I am working on small WPF project in SD. I stumbled upon strange behavior of code formating in my project.
    While I am learning how to code in WPF, usually I use this formating style:

    <Grid Background="LightSkyBlue">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions> 
    </Grid>

    But whenever I change something in Properties window my code changes to this:

    <Grid
        Background="LightSlateGray">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="Auto" />

    <RowDefinition
                    Height="Auto" />
                <RowDefinition
                    Height="*" />
                <RowDefinition
                    Height="*" />
            </Grid.RowDefinitions>
    </Grid>

    My question is, how to avoid this kind of situation?
    Thanks.

  • 08-28-2017 6:12 PM In reply to

    Re: Code formating in WPF project

    That's curious. I'm guessing that as there are different font sizes in your post, it hasn't been formatted exactly how you were intending, but that the thing you're reporting is the whitespace in your XAML - you had each RownDefinition element on its own line with its Height attribute on the same line, and then after doing something, each RowDefinition's Height attribute has moved to a new line?

    I sometimes find that when I start a new line in the code editor, particularly with XAML files, the new line isn't automatically indented to the depth that I'm expecting, but I've never seen it reformat lines that are already there like this (unless I use some of the options in the Edit -> Format menu).

    What exactly did you change in the properties window? What is the object whose properties you edited, and which property did you change?

    I'm not sure I'll have an answer to this question even with this extra information, but anyone who does know enough to give an answer will almost certainly need this information in order to provide an answer.

    Simon

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.