フルスクリーンのBingマップコントロールがあります。その上に、他のさまざまなコントロールをオーバーレイしたいと思います。
<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 ...
問題は、InnerGridが、代わりにマップコントロールが受信する必要のあるマウスイベントを消費することです。背景を透明に設定しても、何の役にも立ちません。
だから、私はRoutedEventsのものを見つけました:
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(...);
つまり、イベントをキャプチャすることはできますが、マップコントロールでイベントをトリガーする方法がわかりません。自動化ピアのことを見てみると、ツールチップを開くなど、マウスダウンよりも高レベルの概念に関心があるようです。
InnerGridコントロールからMapコントロールにすべてのイベントを転送する方法はありますか?
助けてくれてありがとう、ジョン