H&V Alignment Stretch not Working

SyntaxEditor for Silverlight Forum

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

Comments (3)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA

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?


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

Actipro Software Support

Posted 11 years ago by Robert Schmidt
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">
                <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>
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA

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 (v2018.1 build 0233) was released 2 years ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.