Just a preface that I understand that I am executing my decision in a friendly format other than WPF. in an ideal world, I would use MapItemsControl.
Ok, so I use Bing Maps for WPF. Here are my XAML Bing Cards
<m:Map CredentialsProvider="12345" x:Name="myMap" UseInertia="True" Loaded="Map_Loaded" Width="1920" Height="990" Canvas.Top="110" ZoomLevel="5" Center="39.8282,-98.5795"> <m:MapLayer x:Name="MyPushPinLayer"> <Canvas x:Name="ContentPopup" Visibility="Collapsed" Width="250"> <Border Background="White" BorderThickness="1" BorderBrush="Gray" Width="250" Padding="5"> <StackPanel Canvas.Left="20" Canvas.Top="10"> <TextBlock x:Name="ContentPopupText" FontSize="18" FontWeight="Bold" Foreground="#CF0000" Width="240" TextWrapping="Wrap"> </TextBlock> <TextBlock x:Name="ContentAddress" FontSize="13" Foreground="Black" Width="240" TextWrapping="Wrap"/> <TextBlock x:Name="ContentQuestions" FontSize="13" Foreground="Black" Width="240" TextWrapping="Wrap" /> </StackPanel> </Border> </Canvas> </m:MapLayer> </m:Map>
Basically, this draws a map, and I have a maplayer that will hold the tooltip information when clicked. In my code behind, I retrieve data from the service and add buttons on the server in the same way:
Pushpin pin = new Pushpin(); pin.Location = new Microsoft.Maps.MapControl.WPF.Location(location.latitude, location.longitude); pin.Content = location.name; pin.Template = LGPushPinTemplate; pin.MouseDown += new MouseButtonEventHandler(pin_MouseDown); myMap.Children.Add(pin);
Pretty simple. However, since I define the pop-up layer in XAML and children after loading the map, the buttons appear last in the child structure of the map, and therefore the modal info boxes are displayed under any buttons. Is there a way to reorder the z-order of these elements without adding / removing everything from the child map collection? |
source share