public DeviceAdd() { InitializeComponent(); AllowRightClick = true; base.MouseLeave(this, null); AddContextMenu = (ContextMenu)this.Resources["AddContextMenu"]; AddContextMenu.AddHandler(MenuItem.ClickEvent, AddContextMenu_Click); DeviceContextMenu = (ContextMenu)this.Resources["DeviceContextMenu"]; DeviceContextMenu.AddHandler(MenuItem.ClickEvent, DeviceContextMenu_Click); }
public CollapsedDeviceViewer(Device device) { TitleText.Text = device.GetType().ToString().Split(".").Last(); _device = device; _device.Viewer = this; Deselect(); DeviceContextMenu = (ContextMenu)this.Resources["DeviceContextMenu"]; GroupContextMenu = (ContextMenu)this.Resources["GroupContextMenu"]; DeviceContextMenu.AddHandler(MenuItem.ClickEvent, ContextMenu_Click); GroupContextMenu.AddHandler(MenuItem.ClickEvent, ContextMenu_Click); this.AddHandler(DragDrop.DropEvent, Drop); this.AddHandler(DragDrop.DragOverEvent, DragOver); SetEnabled(); }