protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); if (Children.Count == 0) { try { Loaded += OnExplorerFrameLoaded; _frameContent = InitializeExplorerContent(); Children.Add(_frameContent); // Hook up to the Explorer TreeView to Selection ExplorerTreeView.SelectedItemChanged += OnTreeViewSelectionChanged; // Bind the overall Explorer frame context to this class _frameContent.DataContext = this; // Bind the TreeView control to the ViewModel root ReloadViewModel(); // Select the root node and update selection ExplorerTreeRoot.IsSelected = true; UpdateSelection(); } catch (Exception ex) { Debug.Fail("Failed to initialize ExplorerFrame. Exception message: " + ex.Message); } } }
private void Dispose(bool disposing) { if (disposing) { OnResetSearchCommand(); EditingContext = null; _deferredExpansionAndCalculateAdorners.Dispose(); _deferredExpansionAndCalculateAdorners = null; _deferredUpdateNextAndPreviousSearchResults.Dispose(); _deferredUpdateNextAndPreviousSearchResults = null; UnhookScrollBarEvents(_vScrollBar); _vScrollBar = null; if (_frameTreeView != null) { _frameTreeView.ContextMenuOpening -= OnContextMenuOpening; _frameTreeView.PreviewMouseDown -= OnTreeViewPreviewMouseDown; _frameTreeView.PreviewMouseMove -= OnTreeViewPreviewMouseMove; _frameTreeView.PreviewMouseUp -= OnTreeViewPreviewMouseUp; _frameTreeView = null; } if (_frameContent != null) { _frameContent.Dispose(); _frameContent = null; } } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); if (Children.Count == 0) { try { Loaded += OnExplorerFrameLoaded; _frameContent = InitializeExplorerContent(); Children.Add(_frameContent); // Hook up to the Explorer TreeView to Selection ExplorerTreeView.SelectedItemChanged += OnTreeViewSelectionChanged; // Bind the overall Explorer frame context to this class _frameContent.DataContext = this; // Bind the TreeView control to the ViewModel root ReloadViewModel(); // Select the root node and update selection ExplorerTreeRoot.IsSelected = true; UpdateSelection(); } catch (Exception ex) { Debug.Fail("Failed to initialize ExplorerFrame. Exception message: " + ex.Message); } } }
private void Dispose(bool disposing) { if (disposing) { OnResetSearchCommand(); EditingContext = null; _deferredExpansionAndCalculateAdorners.Dispose(); _deferredExpansionAndCalculateAdorners = null; _deferredUpdateNextAndPreviousSearchResults.Dispose(); _deferredUpdateNextAndPreviousSearchResults = null; UnhookScrollBarEvents(_vScrollBar); _vScrollBar = null; if (_frameTreeView != null) { _frameTreeView.ContextMenuOpening -= OnContextMenuOpening; _frameTreeView.PreviewMouseDown -= OnTreeViewPreviewMouseDown; _frameTreeView.PreviewMouseMove -= OnTreeViewPreviewMouseMove; _frameTreeView.PreviewMouseUp -= OnTreeViewPreviewMouseUp; _frameTreeView = null; } if (_frameContent != null) { _frameContent.Dispose(); _frameContent = null; } } }