views:

16

answers:

1

Hello All-

I'm very new to Silverlight and I want to reposition the Grid below in my Silverlight App. I've noticed if I increase the Margin the Grid will drop farther down the screen but it does not go directly down which is what I desire. Instead it goes diagonally downward. So in other words if the Grid is at the Top, Left then I want it to be on the Left but in the Middle (make sense?) Thanks for any help..

<Grid HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Height="Auto" Margin="200" >
        <Border Style="{StaticResource CommonBorder}" Padding="10,3,10,3">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            <StackPanel>
                <TextBlock Text="Navigation Actions" Foreground="White" FontSize="14" FontWeight="Bold" Margin="4" />
                <Button Style="{StaticResource MenuItem}" 
                        Content="Zoom To This Area.." >
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <esriBehaviors:ZoomToAction
                                TargetName="MyMap">
                                <esriBehaviors:ZoomToAction.Geometry>
                                    <esriGeometry:Envelope XMin="-96.45" YMin="31.31" XMax="-93.88" YMax="32.94" />
                                </esriBehaviors:ZoomToAction.Geometry>
                            </esriBehaviors:ZoomToAction>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button Style="{StaticResource MenuItem}" 
                        Content="Zoom To This other Area..." >
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <esriBehaviors:ZoomToAction
                                TargetName="MyMap">
                                <esriBehaviors:ZoomToAction.Geometry>
                                    <esriGeometry:Envelope XMin="-94.32" YMin="34.44" XMax="-90.81" YMax="36.57" />
                                </esriBehaviors:ZoomToAction.Geometry>
                            </esriBehaviors:ZoomToAction>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>

            </StackPanel>
        </Border>
    </Grid>
+2  A: 

Margin has 4 attributes, and giving it only one parameter makes all 4 equal to the number you specify.

Margin="10"

will give a margin of 10 pixels on all sides.

I believe you want to give your grid a margin on only the top:

Margin="0,10,0,0"

The order by the way is left, top, right, bottom.

JGord