There is the EditingMode property for doing all this.
On the following example you can drag an image to the window to add it to the canvas, then use the ComboBox to change the editing mode to something such as Select
to move any items in the canvas.
XAML:
<Window x:Class="WpfApplication8.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Width="525"
Height="350"
AllowDrop="True"
Drop="MainWindow_OnDrop">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Selection mode" />
<ComboBox Width="75"
Margin="2"
ItemsSource="{Binding}"
SelectionChanged="Selector_OnSelectionChanged" />
</StackPanel>
<InkCanvas x:Name="InkCanvas1"
Grid.Row="1"
MoveEnabled="True" />
</Grid>
</Window>
Code-behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace WpfApplication8
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
IEnumerable<InkCanvasEditingMode> values =
Enum.GetValues(typeof (InkCanvasEditingMode)).Cast<InkCanvasEditingMode>();
DataContext = values;
}
private void MainWindow_OnDrop(object sender, DragEventArgs e)
{
object data = e.Data.GetData(DataFormats.FileDrop);
if (data != null)
{
var strings = data as string[];
if (strings != null)
{
string s = strings[0];
var bitmapImage = new BitmapImage(new Uri(s));
var image = new Image
{
Stretch = Stretch.None,
Source = bitmapImage
};
InkCanvas1.Children.Add(image);
}
}
}
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
object addedItem = e.AddedItems[0];
var inkCanvasEditingMode = (InkCanvasEditingMode) addedItem;
InkCanvas1.EditingMode = inkCanvasEditingMode;
}
}
}