我是Silverlight的新手,我想在Silverlight应用程序中重新定位下面的Grid。我注意到如果我增加边距,网格将在屏幕下方向下移动,但它不会直接向下,这是我想要的。相反,它倾斜向下。所以换句话说,如果Grid位于Top,那么我希望它在左边但在中间(有意义吗?)感谢您的帮助......
<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>
答案 0 :(得分:2)
保证金有4个属性,只给它一个参数使得所有4都等于你指定的数字。
Margin="10"
将在所有方面给出10像素的边距。
我相信你只希望给你的网格一个优势:
Margin="0,10,0,0"
顺便说一下,顺序是左,上,右,下。