Hello,
Welcome to Microsoft Q&A!
How to implement multiple InkCanvas with a ListView sharing an InkToolbar?
First of all, it is not supported to share a InkToolbar with multiple InkCanvas at the same time. Please refer to InkToolbar.TargetInkCanvas Property, InkToolbar needs to be associated to a specific InkCanvas. The association is one-to-one.
If you don't want to create multiple InkToolbars, the only way is to change the TargetInkCanvas
of the InkToolbar whenever you want.
Like this:
<InkCanvas x:Name="inkCanvasOne" Grid.Column="0" Grid.Row="1" />
<InkCanvas x:Name="inkCanvasTwo" Grid.Column="1" Grid.Row="1" />
<InkToolbar x:Name="inkToolbar"
VerticalAlignment="Top"
Margin="10,0,10,0"
Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="0"
TargetInkCanvas="{x:Bind inkCanvasOne}"/>
<Button Content="Click" Click="Button_Click"/>
private void Button_Click(object sender, RoutedEventArgs e)
{
inkToolbar.TargetInkCanvas = inkCanvasTwo;
}
Please note that when you change the TargetInkCanvas
property to change the associated InkCanva, the changes you've made in the pervious InkCanva with the InkToolbar will still take effect in the pervious InkCanva but new changes made in the current InkCanva won't take effect in the pervious InkCanva.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.