WPF에서 간단한 양식을 작성 중이므로 제대로 작동합니다. 하지만 이제 목표 프레임 워크를 4에서 3.5로 변경해야합니다. 하지만 3.5 버전을 실행하면 예외적으로 실패합니다.창을 숨길 때 InvalidOperationException이 발생합니다.
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
{
_notificator = new Notificator(Directory.GetCurrentDirectory());
_notificator.EventStarted += (o, ev) => Dispatcher.Invoke(new Action(() =>
{
new NotificationPage(ev).Show();
_collection.Remove(ev);
}));
_notificator.EventRemoved += (o, ev) => _collection.Remove(ev);
_notificator.EventAdded += (o, ev) => _collection.Insert(_notificator.Events.IndexOf(ev), ev);
_collection = new ObservableCollection<MyEvent>(_notificator.Events);
EventsGrid.DataContext = _collection;
_notificator.Start();
LostEventsGrid.DataContext = _notificator.LostEvents;
Hide();
}
내가 모든 방법을 썼다, 그러나 그것은 단지 Two-way binding requires Path or XPath
와 숨기기 방법에 실패 그래서 OnLoaded
이 같다. 스택 트레이스 :
.NET에서System.Windows.Data.BindingExpression.CreateBindingExpression (DependencyObject에 d를 DependencyProperty에 DP, 제본 바인딩 BindingExpressionBase 부모) System.Windows.Data.Binding.CreateBindingExpressionOverride (DependencyObject의 타겟 в , DependencyProperty에 DP, BindingExpressionBase в Microsoft.Windows.Controls.DataGridTextColumn в 결합 System.Windows.Data.BindingOperations.SetBinding (DependencyObject의 대상, DependencyProperty에 DP, BindingBase) Microsoft.Windows.Controls.DataGridBoundColumn.ApplyBinding (DependencyObject의 타겟 в , DependencyProperty에 속성) в 소유자) .GenerateElement (DataGridCell 셀, ObjectDataItem) в 마이크로 초 ft.Windows.Controls.DataGridColumn.BuildVisualTree (Boolean isEditing, Object dataItem, DataGridCell 셀) Microsoft.Windows.Controls.DataGridCell.BuildVisualTree() Microsoft.Controls.DataGridCell.PrepareCell (개체 항목, DataGridRow ownerRow, INT32 지수) Microsoft.Windows.Controls.DataGridCell.PrepareCell (개체 항목 System.Windows в Microsoft.Windows.Controls.Primitives.DataGridCellsPresenter.PrepareContainerForItemOverride в ItemsControl에 cellsPresenter, DataGridRow ownerRow) (DependencyObject의 요소, 개체 항목) в . Control.ItemsControl.MS.Internal.Controls.GeneratorHost.PrepareItemContainer (DependencyObject 컨테이너, 개체 항목) в System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer (종속성 객체 컨테이너) Microsoft.Windows.Controls.DataGridCellsPanel.InsertContainer (INT32 childIndex에, UIElement에 컨테이너, 부울 isRecycled) Microsoft.Windows.Controls.DataGridCellsPanel.InsertNewContainer в (INT32 childIndex에, UIElement에 컨테이너) Microsoft.Windows.Controls в в . Microsoft.Windows.Controls.DataGridCellsPanel.GenerateChild в DataGridCellsPanel.AddContainerFromGenerator (INT32 childIndex에, UIElement에 아이, 부울 newlyRealized) (IItemContainerGenerator 발생기, 크기 제약은 DataGridColumn 열, INT32 & childIndex에, 크기 & childSize) Microsoft.Windows.Controls в . DataGridCellsPanel.GenerateChildren (IItemContainerGenerator 생성기, Int32 startIndex, Int32 endIndex, 크기 제약 조건) Microsoft.Windows.Controls. DataGridCellsPanel.GenerateAndMeasureChildrenForRealizedColumns (크기 제한) Microsoft.Windows.Controls.DataGridCellsPanel.MeasureOverride (크기 제한) в System.Windows.FrameworkElement.MeasureCore (크기 availableSize) в System.Windows.UIElement.Measure (크기 availableSize) в в MSControls.ItemsPresenter.MeasureOverride (크기 제한 조건) System.Windows.FrameworkElement.MeasureCore (Size availableSize) System.Windows.UIElement. Measure (Size availableSize) System.Windows.Controls.Control.MeasureOverride (크기 제약 조건) Microsoft.Windows.Controls.Primitives.DataGridCellsPresenter .MeasureOverride (Size availableSize) System.Windows.FrameworkElement.MeasureCore (Size availableSize) System.Windows.UIElement.Measure (Size availableSize) System.Windows.Controls.Grid.MeasureCell (Int32 셀, 부울 forceInfinityV) System.Windows.Controls.Grid.MeasureCellsGroup (INT32 cellsHead, 크기 referenceSize, 부울 ignoreDesiredSizeU, 부울 forceInfinityV) 시스템 в System.Windows.FrameworkElement.MeasureCore в System.Windows.Controls.Grid.MeasureOverride в (크기 제한) (크기 availableSize) . Windows.UIElement.Measure (Size availableSize) System.Windows.Controls.Border.MeasureOverride (크기 제약 조건) System.Windows.FrameworkElement.MeasureCore (크기 availableSize) System.Windows.UIElement.Measure (Size availableSize) System.Windows.Controls.Control.MeasureOverride (크기 제약 조건) System.Windows.FrameworkElement.MeasureCore (크기 availableSize) System.Windows.UIElement.Measure (Size availableSize) System.Windows.Controls.VirtualizingStackPanel.MeasureOverride (크기 제한) в в Microsoft.Windows.Controls.Primitives.DataGridRowsPresenter.MeasureOverride (크기 제한) System.Windows.FrameworkElement.MeasureCore (크기 availableSize) в System.Windows в .UIElement.Measure (크기 availableSize) System.Windows.ContextLayoutManager.UpdateLayout (в ) System.Windows.Interop.HwndSource.Process_WM_SIZE в (UIElement에 rootUIElement, IntPtr입니다 HWND, INT32의 MSG, IntPtr입니다의 wParam, IntPtr입니다의 lParam) 시스템 в . Windows.Interop.HwndSource.LayoutFilterMessage (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, 부울 & 처리됨) MS.Win32.HwndWrapper.WndProc (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean,처리) MS.Win32.HwndSubclass.DispatcherCallbackOperation (객체 O) System.Windows.Threading.ExceptionWrapper.InternalRealCall в в (대리인 콜백 인수 개체 부울 isSingleParameter) System.Windows.Threading.ExceptionWrapper.TryCatchWhen в (개체 (delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) System.Windows.Threading.Dispatcher.WrappedInvoke (대리자 콜백, 개체 args, 부울 isSingleParameter, 대리자 catchHandler)System.Windows.Threading.Dispatcher.WrappedInvoke 대리자 콜백, 개체 args, 부울 isSingleParameter) System.Windows.Threading.Dispatcher.InvokeImpl (DispatcherPriority 우선 순위, TimeSpan 시간 제한, 대리 메서드, 개체 args, 부울 isSingleParameter) System.Windows.Threading.Dispatcher.Invoke (DispatcherPriority 우선 순위, 대리 메서드, 개체 arg) MS.Win32.HwndSubclass.SubclassWndProc (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) в MS.Win32.UnsafeNativeMethods .CallWindowProc (WNDPROC을 IntPtr, HWND를 IntPtr, INT32의 MSG,을 IntPtr의 wParam,을 IntPtr의 lParam) MS.Win32.UnsafeNativeMethods.CallWindowProc в MS.Win32.HwndSubclass.DefWndProcWrapper (HWND를 IntPtr, INT32의 MSG,을 IntPtr의 wParam,을 IntPtr의 lParam) (в 를 IntPtr WNDPROC, HWND를 IntPtr, INT32의 MSG,을 IntPtr의 wParam,을 IntPtr의 lParam) MS.Win32.HwndSubclass.SubclassWndProc в MS.Win32.HwndSubclass.CallOldWindowProc (oldWndProc을 IntPtr, HWND를 IntPtr, INT32의 MSG,을 IntPtr의 wParam,을 IntPtr의 lParam) в (IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
,363,210
4+가 잘
안녕하세요, 당신은 당신이이 문제를 해결하기 위해 참조 정확하게 조립 무엇 버전 설명해 할 수 있습니까? – MoMo
@MoMo .Net 4.0+ 이상을 사용해야하며 모든 프로젝트에서 WPFToolkit을 참조하지 마십시오. 제 경우에는 효과가있었습니다. –