0
Answer

Selecting Eraser for all InkCanvases opened in tabs

Hello!
 
I'm using below code to load inkCanvases to tabs dynamically in the same tab control 
  1. foreach (var di in DIList)  
  2.             {  
  3.                 var grid = new Grid();  
  4.                 var inkCanvas = new InkCanvas()  
  5.                 {  
  6.                     Width = grid.Width,  
  7.                     HorizontalAlignment = System.Windows.HorizontalAlignment.Left,  
  8.                     VerticalAlignment = System.Windows.VerticalAlignment.Top  
  9.                 };  
  10.   
  11.                 SourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Docs\DI\" + di + ".bmp");  
  12.                 img = GetBitmap(SourcePath);  
  13.   
  14.                 myImageBrush = new ImageBrush(img);  
  15.   
  16.                 myCanvas = new Canvas();  
  17.                 myCanvas.Width = img.Width;  
  18.                 myCanvas.Height = img.Height;  
  19.                 myCanvas.Background = myImageBrush;  
  20.   
  21.                 inkCanvas.Height = img.Height;  
  22.                 inkCanvas.Children.Add(myCanvas);  
  23.                 inkCanvas.DefaultDrawingAttributes.Color = Colors.Red;  
  24.                 grid.Children.Add(inkCanvas);  
  25.   
  26.                 var item = new TabItem();  
  27.                 item.Header = di;  
  28.                 item.Content = grid;  
  29.   
  30.                 cw.tabCanvas.Items.Add(item);  
  31.                 // cw.DI.Add(di);  
  32.             }  
So i want to change the Editing mode InkCanvasEditingMode.EraseByStroke of the Canvases when i click a button. I want it to apply for the all the canvases present. How can i do it.
 
when i do like this inkcanvas1.EditingMode = InkCanvasEditingMode.EraseByStroke it works but i want it to recognize the canvases in present in the tabs and apply erase mode to all. Please help. Much thanks.