hi there is a class
public class Cell : Image { public event MouseButtonEventHandler LeftClick { add { MouseLeftButtonDown += value; } remove { MouseLeftButtonDown -= value; } } static Cell() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Cell), new FrameworkPropertyMetadata(typeof(Cell))); } public event MouseButtonEventHandler RightClick { add { MouseRightButtonDown += value; } remove { MouseRightButtonDown -= value; } } } In another class, I created several instances of this class. But I want to process the mouse click in a separate class. How can you go there to transfer these events. I made 2 events
public event MouseButtonEventHandler LeftClick { add { MouseLeftButtonDown += value; } remove { MouseLeftButtonDown -= value; } } public event MouseButtonEventHandler RightClick { add { MouseRightButtonDown += value; } remove { MouseRightButtonDown -= value; } } But that does not work out. How to. As I understand it, delegates should probably be used, but I don’t understand how.
myCell.LeftClick += otherObj.Method;- Andrei NOPCellclass must be defined in theCellclass. But you can subscribe to them anywhere. - VladD