private void treeList1_FilterNode_1(object sender, DevExpress.XtraTreeList.FilterNodeEventArgs e) { string NodeText = e.Node.GetDisplayText(treeList1.Nodes[0].Id); bool IsVisible = NodeText.ToUpper().IndexOf(nodeText.ToUpper()) >= 0 || e.Node.GetValue("DWMC").ToString().IndexOf(nodeText.ToUpper()) >= 0; if (IsVisible) { DevExpress.XtraTreeList.Nodes.TreeListNode Node = e.Node.ParentNode; while (Node != null) { if (!Node.Visible) { Node.Visible = true; Node = Node.ParentNode; } else { break; } } } e.Node.Visible = IsVisible; e.Handled = true; }
/// <summary> /// 设定树的过来条件 /// </summary> private void treeListBom_FilterNode(object sender, DevExpress.XtraTreeList.FilterNodeEventArgs e) { //try //{ // string nodeCFNStr = DataTypeConvert.GetString(e.Node["CodeFileName"]); // string codeFileNameStr = DataTypeConvert.GetString(searchCodeFileName.Text); // bool IsVisible = nodeCFNStr.IndexOf(codeFileNameStr) >= 0; // if (IsVisible) // { // TreeListNode Node = e.Node.ParentNode; // while (Node != null) // { // if (!Node.Visible) // { // Node.Visible = true; // Node = Node.ParentNode; // } // else // break; // } // } // e.Node.Visible = IsVisible; // e.Handled = true; //} //catch (Exception ex) //{ // //ExceptionHandler.HandleException(this.Text + "--设定树的过来条件错误。", ex); // ExceptionHandler.HandleException(this.Text + "--" + tsmiSdsdgltjcw.Text, ex); //} }
/// <summary> /// 当前树饿筛选过滤条件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void treeList1_FilterNode(object sender, DevExpress.XtraTreeList.FilterNodeEventArgs e) { int i = 0; i++; TreeList list = (sender as TreeList); _Directory info = list.GetDataRecordByNode(e.Node) as _Directory; if (info != null) { if (info.Parent.ObjectState == EObjectState.Delete) { e.Node.Visible = false; } e.Handled = true; } }
private void TreeList_FilterNode(object sender, DevExpress.XtraTreeList.FilterNodeEventArgs e) { TreeList tree = sender as TreeList; if (tree == null) { return; } string sFilter = tree.FindFilterText; if (string.IsNullOrEmpty(sFilter)) { return; } var bFirst = sFilter.Substring(0, 1).Equals(@""""); var bLast = sFilter.Substring(sFilter.Length - 1, 1).Equals(@""""); if (bFirst && bLast) { return; } if (!bFirst && !bLast) { tree.FindFilterText = @"""" + tree.FindFilterText + @""""; } else if (!bFirst) { tree.FindFilterText = @"""" + tree.FindFilterText; } else if (!bLast) { tree.FindFilterText = tree.FindFilterText + @""""; } }
private void treeList1_FilterNode(object sender, DevExpress.XtraTreeList.FilterNodeEventArgs e) { }