Hello!
I'm using below code to load inkCanvases to tabs dynamically in the same tab control
- foreach (var di in DIList)
- {
- var grid = new Grid();
- var inkCanvas = new InkCanvas()
- {
- Width = grid.Width,
- HorizontalAlignment = System.Windows.HorizontalAlignment.Left,
- VerticalAlignment = System.Windows.VerticalAlignment.Top
- };
- SourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Docs\DI\" + di + ".bmp");
- img = GetBitmap(SourcePath);
- myImageBrush = new ImageBrush(img);
- myCanvas = new Canvas();
- myCanvas.Width = img.Width;
- myCanvas.Height = img.Height;
- myCanvas.Background = myImageBrush;
- inkCanvas.Height = img.Height;
- inkCanvas.Children.Add(myCanvas);
- inkCanvas.DefaultDrawingAttributes.Color = Colors.Red;
- grid.Children.Add(inkCanvas);
- var item = new TabItem();
- item.Header = di;
- item.Content = grid;
- cw.tabCanvas.Items.Add(item);
- // cw.DI.Add(di);
- }
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.
Replies
Know the answer? Post it — somebody with the same question will find it here.