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>
<Canvas x:Name="editCanvas" Background="BlanchedAlmond" ClipToBounds="True"> <InkCanvas x:Name="inkCanvas"> <InkCanvas.Background> <ImageBrush Source="C:\\Image.png"></ImageBrush> </InkCanvas.Background> </InkCanvas> </Canvas>
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)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.