2012-08-30 2 views
0

https://compositewpfcontrib.svn.codeplex.com/svn/Trunk/src/Extensions.Infragistics/Composite.Wpf.Infragistics/CompositeWPFContrib.Composite.Wpf.Infragistics/XamDockManager/Regions/TabGroupPaneRegionAdapter.cs에서 TabGroupPaneRegionAdapter를 사용하고 있습니다.Infragistics 용 TabGroupPaneRegionAdapter 문제

이 문제는 contentpane의 Closed 이벤트가 'contentPane.ExecuteCommand (ContentPaneCommands.Close); 즉, 십자가 버튼을 눌렀을 때 닫힌 이벤트가 처음 호출되었을 때 xamDockManager에 계속 남아 있기 때문에 "contentPane.ExecuteCommand (ContentPaneCommands.Close);" 닫힌 이벤트를 다시 실행하고 호출합니다. 어떤 아이디어가 이것을 해결하는 방법.

private void OnViewsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e, IRegion region, TabGroupPane regionTarget) 
    { 
     if (e.Action == NotifyCollectionChangedAction.Add) 
     { 
      //Add content panes for each associated view. 
      foreach (object item in e.NewItems) 
      { 
       UIElement view = item as UIElement; 

       if (view != null) 
       { 
        ContentPane newContentPane = new ContentPane(); 
        newContentPane.Content = item; 
        //if associated view has metadata then apply it. 
        if (view.GetTabGroupPaneMetadata() != null) 
        { 
         newContentPane.Header = (view.GetTabGroupPaneMetadata()).Header; 
        } 
        //When contentPane is closed remove the associated region 
        newContentPane.Closed += delegate(object contentPaneSender, PaneClosedEventArgs args) 
        { 
         OnContentPaneClosed((ContentPane)contentPaneSender, args, region); 
        }; 


        regionTarget.Items.Add(newContentPane); 
       } 
      } 
     } 
     else 
     { 
      if (e.Action == NotifyCollectionChangedAction.Remove) 
      { 
       //Associated View has been removed => remove the associated ContentPane from XamDockManager 
       XamDockManager xamDockManager = regionTarget.FindDockManager(); 
       IEnumerable<ContentPane> contentPanes = xamDockManager.GetPanes(PaneNavigationOrder.VisibleOrder); 

       foreach (ContentPane contentPane in contentPanes) 
       { 
        if (e.OldItems.Contains(contentPane.Content)) 
        { 
         contentPane.Content = null; 
         contentPane.CloseAction = PaneCloseAction.RemovePane; 
         contentPane.ExecuteCommand(ContentPaneCommands.Close); 
        } 
       } 


      } 
     } 
    } 

    private void OnContentPaneClosed(ContentPane contentPane, PaneClosedEventArgs args, IRegion region) 
    { 
     object view = contentPane.Content; 
     if (region.Views.Contains(view)) 
     { 
      region.Remove(view); 
     } 
    } 

어떤 도움이 많이 주시면 감사합니다 감사 : 여기

어댑터의 코드의 일부입니다. Imad.

답변

관련 문제