나는 이상하게 들리 겠지만 사실입니다.바인딩은 Visio 이벤트가 발사되는 것을 방지합니다.
Visio 컨트롤을 호스팅하는 WPF 응용 프로그램이 있습니다. 거기에 아무런 문제가 없습니다. DocumentOpened와 같은 일부 필수 이벤트가 작동합니다.
예를 들어 BeforeShapeDeleted, CellChanged와 같은 다른 이벤트를 처리하려는 경우 Shapes를 DocumentOpened의 ListBox에 바인딩하면 해당 이벤트가 중지됩니다. 여기
내 코드입니다 : 코드에 따라public partial class MainWindow : Window { private AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl visioControl = new AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl(); public MainWindow() { InitializeComponent(); this.host.Child = this.visioControl; } private void Window_Loaded(object sender, RoutedEventArgs e) { this.visioControl.DocumentOpened += new AxMicrosoft.Office.Interop.VisOcx.EVisOcx_DocumentOpenedEventHandler(visioControl_DocumentOpened); this.visioControl.Window.Application.BeforeShapeDelete += new Microsoft.Office.Interop.Visio.EApplication_BeforeShapeDeleteEventHandler(Application_BeforeShapeDelete); this.visioControl.Window.Application.CellChanged += new Microsoft.Office.Interop.Visio.EApplication_CellChangedEventHandler(Application_CellChanged); } void Application_CellChanged(Microsoft.Office.Interop.Visio.Cell Cell) { MessageBox.Show("Changed"); } void Application_BeforeShapeDelete(Microsoft.Office.Interop.Visio.Shape Shape) { MessageBox.Show("Deleted"); } void visioControl_DocumentOpened(object sender, AxMicrosoft.Office.Interop.VisOcx.EVisOcx_DocumentOpenedEvent e) { //if I comment the line bellow BeforeShapeDelete and CellChanged will work, if I leave it uncommented, they won't work... lstShapes.ItemsSource = this.visioControl.Window.Application.ActivePage.Shapes; } private void mnuOpen_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlgOpenDiagram = new Microsoft.Win32.OpenFileDialog(); if (dlgOpenDiagram.ShowDialog() == true) { this.visioControl.Src = dlgOpenDiagram.FileName; } } }문제가 ItemsSource를 정의하는 라인에 DocumentOpened 방법에 달려있다
...
이 Visio 2007입니까? – gordatron