H&V Alignment Stretch not Working

SyntaxEditor for Silverlight Forum

Posted 14 years ago by Robert Schmidt
Version: 10.1.0101
Avatar
It appears as though the "stretch" setting for the H & V Alignment & ContentAlignment properties on the SyntaxEditor have no effect.

Comments (3)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

There are a number of legitimate reasons that can cause the Horizontal/Vertical alignment properties to have no effect. For instance, if the panel that the SyntaxEditor is placed in is a Canvas, those properties have no meaning since a Canvas uses absolute positioning. Also, if the Width/Height properties are set on the SyntaxEditor, you will find that those properties do nothing when set to stretch. In general, the value of those properties are potentially treated differently by any object that is capable of having child content.

I wasn’t able to reproduce the issue you described with the tests that I ran. What type of panel is the SyntaxEditor placed in? What are all the properties you have set on the SyntaxEditor? Also, what properties are set on the panel that contains the SyntaxEditor?

Thanks.

[Modified at 08/12/2010 05:39 PM]


Actipro Software Support

Posted 14 years ago by Robert Schmidt
Avatar
The SyntaxEditor is a child of a StackPanel. The stack panel is stretched. I can tell by setting the background color.

Here is the xaml;

    <Controls:TabControl x:Name="tabControl">
        <Controls:TabItem x:Name="editorTab" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
            <Controls:TabItem.Header>
                Editor
            </Controls:TabItem.Header>
            <Controls:TabItem.Content>
                <StackPanel x:Name="stackPanel" Background="Aqua"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                    <editor:SyntaxEditor x:Name="syntaxEditor" DocumentTextChanged="OnEditorDocumentTextChanged" IsLineNumberMarginVisible="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">
                        <editor:EditorDocument x:Name="document">
                            <system:String xml:space="preserve">Test</system:String>
                        </editor:EditorDocument>
                    </editor:SyntaxEditor>
                </StackPanel>
            </Controls:TabItem.Content>
        </Controls:TabItem>
    </Controls:TabControl>
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The StackPanel treats alignment properties different than other panel types. The alignment that matches the StackPanel orientation does nothing at all, so you need to specify a height for the SyntaxEditor control in the case of the code you posted. The other alignment will default to Stretch. If you want to set something other than stretch, you will need to set a size, Width in this case.

Please let us know if you have further questions.


Actipro Software Support

The latest build of this product (v18.1 build 0233) was released 4 years ago, which was after the last post in this thread.