How to implement multiple InkCanvas with a ListView sharing an InkToolbar?

鲤鱼 秀 65 Reputation points

I urgently need to implement this feature in my program. If you can help me, I will be very grateful!

Universal Windows Platform (UWP)
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,364 questions
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
769 questions
0 comments No comments
{count} votes

Accepted answer
  1. Roy Li - MSFT 32,466 Reputation points Microsoft Vendor


    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" 
                   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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful