如何在C#中展开网格中的映射?
xaml如何在C#中展开网格中的映射?,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,xaml 添加三行定义并在网格中添加地图后,问题解决了。是否有任何错误或根本不起作用?没有错误,地图中的位置就像下降,但地图的高度没有变化。这是因为它位于网格中并与listselector共享点吗?很可能是因为垂直对齐设置为底部。试着摆脱它看看。 <Grid x:Name="LayoutRoot"> <maps:Map x:Name="mapWithMyLocation" HorizontalAlignment="Left" Margin="1,0,0,443" Ver
添加三行定义并在网格中添加地图后,问题解决了。是否有任何错误或根本不起作用?没有错误,地图中的位置就像下降,但地图的高度没有变化。这是因为它位于网格中并与listselector共享点吗?很可能是因为垂直对齐设置为底部。试着摆脱它看看。
<Grid x:Name="LayoutRoot">
<maps:Map x:Name="mapWithMyLocation" HorizontalAlignment="Left" Margin="1,0,0,443" VerticalAlignment="Bottom" Height="233" Width="479" ZoomLevel="10"/>
<Grid Margin="0,0,0,77" Grid.Row="1" RenderTransformOrigin="0.5,0.5" Height="366" VerticalAlignment="Bottom" Grid.ColumnSpan="2">
<phone:LongListSelector x:Name="closestBusList" ItemsSource="{Binding KioskList}" SelectionChanged="closestBusList_SelectionChanged_1" Height="366" VerticalAlignment="Top">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Opacity="0.5" Background="WhiteSmoke">
<TextBlock FontWeight="Bold" Foreground="#0145A6" FontSize="14" x:Name="owner" Text="{Binding owner}"></TextBlock>
<TextBlock FontWeight="Bold" Foreground="#038edf" FontSize="12" x:Name="addres" Text="{Binding address}"></TextBlock>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</Grid>
</Grid>
private void expand_btn_Click(object sender, RoutedEventArgs e)
{
double height = this.mapWithMyLocation.Height;
double from, to;
// animate from 150 to 800, or vice versa
if (height == 233)
{
from = 233;
to = 800;
closestBusList.Visibility = Visibility.Collapsed;
}
else
{
from = 800;
to = 233;
closestBusList.Visibility = Visibility.Visible;
}
Storyboard sb = new System.Windows.Media.Animation.Storyboard();
DoubleAnimation fillHeightAnimation = new System.Windows.Media.Animation.DoubleAnimation();
fillHeightAnimation.From = from;
fillHeightAnimation.To = to;
fillHeightAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.3));
Storyboard.SetTarget(fillHeightAnimation, this.mapWithMyLocation);
Storyboard.SetTargetProperty(fillHeightAnimation, new PropertyPath("Height"));
sb.Children.Add(fillHeightAnimation);
sb.Begin();
}