質問

私は作ろうとしています GMap.Net wpfビルドインイベントを使用して、マルチタッチを有効に制御しますが、私は成功しませんでした。

私は次のようなマルチタッチに関する一連の記事を見つけました これは...これは... 一つ。それらのすべてで, ManipulationContainer キャンバスとその上に配置された可動コントロールですが、GMapの問題で ManipulationContainerGMapControl そして、それを制御することはできません。どうすれば使用できますか e.ManipulationDelta ズームして移動するデータ?

ザ- GMapControl を持っている Zoom それを増減することによって、あなたがズームインまたはズームアウトすることができますプロパティ。

役に立ちましたか?

解決

コードを簡単に見ると、次のことが示されています GMapControl である。 ItemsContainer.

あなたはスタイルを変更することができるはずです ItemsPanel 型板は供給し、 IsManipulationEnabled プロパティがあります:

<g:GMapControl x:Name="Map" ...>
   <g:GMapControl.ItemsPanel>
       <ItemsPanelTemplate>
           <Canvas IsManipulationEnabled="True" />
       </ItemsPanelTemplate>
   </g:GMapControl.ItemsPanel>
   <!-- ... -->

この時点で、あなたは配線する必要があります Window:

<Window ...
    ManipulationStarting="Window_ManipulationStarting"
    ManipulationDelta="Window_ManipulationDelta"
    ManipulationInertiaStarting="Window_InertiaStarting">

そして、コードビハインドで適切なメソッドを提供します(恥知らずに盗まれ、これから適応されます MSDNウォークスルー):

void Window_ManipulationStarting(
    object sender, ManipulationStartingEventArgs e)
{
    e.ManipulationContainer = this;
    e.Handled = true;
}

void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
    // uses the scaling value to supply the Zoom amount
    this.Map.Zoom = e.DeltaManipulation.Scale.X;
    e.Handled = true;
}

void Window_InertiaStarting(
    object sender, ManipulationInertiaStartingEventArgs e)
{
    // Decrease the velocity of the Rectangle's resizing by 
    // 0.1 inches per second every second.
    // (0.1 inches * 96 pixels per inch / (1000ms^2)
    e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0);
    e.Handled = true;
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top