Reputation: 85
I'm trying to make a control where you can paint something on image and save that image with new staff.
At the moment I'm using Ink Canvas because it's really useful control, but I couldn't find how to merge it with background image. Moreover, I don't want InkCanvas to be dropped anywhere in image, I want it to be exactly in that place where it was painted.
Question: How to merge InkCanvas with image?
Current code:
<Grid>
<Image x:Name="Image_Container"/>
<InkCanvas Background="Transparent" IsEnabled="False" Width="Auto" Name="inkCanvas" />
</Grid>
Upvotes: 1
Views: 2266
Reputation: 928
XAML Code
<Grid>
<InkCanvas Name="inkCanvas1" />
</Grid>
C# Code behind
string pathBackgroundimage = "D:/Workspace/Image1.png";
inkCanvas1.IsBackGroundMovable = false;
inkCanvas1.Background = new ImageBrush(new BitmapImage(new Uri(pathBackgroundimage)));
Upvotes: 2
Reputation: 315
<Canvas x:Name="editCanvas" Background="BlanchedAlmond" ClipToBounds="True">
<InkCanvas x:Name="inkCanvas">
<InkCanvas.Background>
<ImageBrush Source="C:\Image.png"></ImageBrush>
</InkCanvas.Background>
</InkCanvas>
</Canvas>
Upvotes: 2