Question

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>
Was it helpful?

Solution

<Canvas x:Name="editCanvas" Background="BlanchedAlmond" ClipToBounds="True"> <InkCanvas x:Name="inkCanvas"> <InkCanvas.Background> <ImageBrush Source="C:\Image.png"></ImageBrush> </InkCanvas.Background> </InkCanvas> </Canvas>

OTHER TIPS

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)));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top