0

I got this Zoomborder.cs and added it to my Project. Currently I have a big map that I can freely drag around.
In this map I have this Code block to generate Images/canvas on the Map:

<ItemsControl ItemsSource="{Binding RectItems}">
<ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
        <Canvas/>
    </ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
    <DataTemplate>
        <Rectangle Width="{Binding Width}" Height="{Binding Height}" Fill="Black">
            <Rectangle.RenderTransform>
                <TranslateTransform X="{Binding X}" Y="{Binding Y}"/>
            </Rectangle.RenderTransform>
        </Rectangle>
    </DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

but now I want to drag and drop this Images/canvas too. I tried it with a few ways but I cant get it to work because the Zoomborder.cs is also trying to drag the map.

Is there some way to get this rectangle to drag and drop within the Zoom element?

Full Code example:

<Zoom:Zoomborder x:Name="border" ClipToBounds="True" Background="Gray">
    <Grid x:Name="firstChild">
         <Image Width="4045" Width="2823" Source="..." ... />
         //Here is the Code block from above.
    </Grid>
</Zoom>
SomePerson
  • 581
  • 1
  • 6
  • 18
  • Does the `ItemsControl` need to be inside the `Zoomborder`? Also, you could change the `Zoomborder` code so that they need to press some other key to move the map, like Ctrl. – redcurry Jan 28 '19 at 15:10
  • Yeah, i want the Itemscontrol inside the ZoomBorder to move them too etc. That with the other key press sounds nice, I think I will try that. – SomePerson Jan 28 '19 at 15:15

0 Answers0