2017-08-06 84 views
0

在UWP上像下面的圖像一樣在MapControl上創建菜單有什麼想法嗎?UWP應用程序上的MapControl可能具有Flyout菜單嗎?

sample map menu

+0

你能告訴你去哪裏遇到的問題和你嘗試過什麼?至於直接的答案 - 是的,這是可能的。目前你的問題太廣泛了。 – Romasz

+0

我試圖使用Flyout,但無法在屏幕的左側和頂部設置Flyout內容的正確位置。 –

+0

我不想使用菜單或漢堡菜單,因爲這個菜單是有條件的,當用戶點擊地圖 –

回答

1

有多種方式可以做到這一點。根據您的意見,一種方法可能是將虛擬UIElement放置在地圖下(使用合適的菜單)並在需要時顯示。 XAML:

<Grid x:Name="MainGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
    <Border x:Name="SamapleBorder" HorizontalAlignment="Left" VerticalAlignment="Top"> 
     <Border.ContextFlyout> 
      <MenuFlyout Placement="Bottom"> 
       <MenuFlyoutItem Text="Item 1"/> 
       <MenuFlyoutItem Text="Item 2"/> 
       <MenuFlyoutItem Text="Item 3"/> 
      </MenuFlyout> 
     </Border.ContextFlyout> 
    </Border> 
    <Rectangle Fill="Beige" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Tapped="Rectangle_Tapped"/> 
</Grid> 

和後面的代碼:

private void Rectangle_Tapped(object sender, TappedRoutedEventArgs e) => this.SamapleBorder.ContextFlyout.ShowAt(this.SamapleBorder); 

MenuOverRectangle

相關問題