Skip to content

Commit

Permalink
Filters applied to the object explorer now show the child nodes of an…
Browse files Browse the repository at this point in the history
…y nodes that match the filter (I.E. Tables that match will show their columns.)
  • Loading branch information
Great Dead Cthulhu committed May 30, 2018
1 parent 10d6f06 commit 99cf3f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Databvase-Winforms/Modules/ObjectExplorer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Databvase-Winforms/Modules/ObjectExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
using DevExpress.XtraEditors;
using DevExpress.XtraSplashScreen;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Columns;
using DevExpress.XtraTreeList.Nodes;
using DevExpress.XtraTreeList.Nodes.Operations;
using Microsoft.SqlServer.Management.Smo;

namespace Databvase_Winforms.Modules
Expand All @@ -41,8 +43,10 @@ private void HookupEvents()
treeListObjExp.PopupMenuShowing += TreeListObjectExplorerOnPopupMenuShowing;
treeListObjExp.MouseDown += TreeListObjExpOnMouseDown;
treeListObjExp.NodeChanged += TreeListObjExpOnNodeChanged;
treeListObjExp.CustomRowFilter += TreeListObjExpOnCustomRowFilter;
}


private void RegisterServices()
{
mvvmContextObjectExplorer.RegisterService(new BackupViewService());
Expand Down Expand Up @@ -113,6 +117,22 @@ private static void SetHasChildrenForNode(NodeChangedEventArgs e, ObjectExplorer
}
}

/// <summary>
/// Used to apply custom filter logic. For Databvase's object explorer, this is used to show the child nodes of anything that
/// matches the filter criteria.
/// Source: https://www.devexpress.com/Support/Center/Question/Details/T528434/treelist-how-to-show-child-nodes-if-their-parent-node-satisfies-the-currently-applied
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TreeListObjExpOnCustomRowFilter(object sender, CustomRowFilterEventArgs e)
{
if (e.Node.ParentNode != null && e.Node.ParentNode.Visible)
{
e.Node.Visible = true;
e.Handled = true;
}
}

#endregion


Expand Down

0 comments on commit 99cf3f5

Please sign in to comment.