I have a full-screen Bing map control. Over the top, I want to overlay various other controls.
<Grid>
<maps:Map x:Name="Map" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Grid Style="{StaticResource LayoutRootStyle}" Background="Transparent"
x:Name="InnerGrid">
<Grid.RowDefinitions>
<RowDefinition Height="132" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="700" />
<ColumnDefinition Width="350" />
</Grid.ColumnDefinitions>
... Content ...
The trouble is that the InnerGrid consumes the mouse events which I need the map control to receive instead. Setting the background to transparent has done nothing useful.
So, I found the RoutedEvents stuff:
internal sealed partial class PageCodeBehind : Page
{
public PageCodeBehind()
{
InitializeComponent();
InnerGrid.AddHandler(PointerPressedEvent, new PointerEventHandler(OnPointerPressedEvent), true);
InnerGrid.AddHandler(PointerMovedEvent, new PointerEventHandler(OnPointerMovedEvent), true);
}
private void OnPointerPressedEvent(object sender, PointerRoutedEventArgs pointerRoutedEventArgs)
{
// I can hit a breakpoint here...
var peer = FrameworkElementAutomationPeer.FromElement(GigMap) as MapAutomationPeer;
peer.RaiseAutomationEvent(...);
So – I can capture the event, but I have no idea how to trigger the event on the Map control. Having looked at the automation peer stuff – it seems like they are concerned with higher-level concepts than mouse-down, such as open tool-tip etc.
Any idea how I forward all events from my InnerGrid control to the Map control?
Many thanks for any help,
Jon
Ok – I found a work-around. Setting Background=”{x:Null}” on the InnerGrid makes it forward events. Beautifully undocumented as always on MSDN 🙂
I’d still like to know any other methods available though if anyone knows more information.
Many thanks,
Jon