CIMATRON IT-12 version使用 12.00怎样使用水平切削才能让刀路没有进退刀痕迹

2710人阅读
XtraTreeList(12)
工作中由于客户要求一些特殊节点的某一列必须控制其可编辑状态,所以通过查阅资料和自己的实践发现可以通过以下的步骤实现这样的要求,现把代码分享一下.
首先启用TreeList的ShowingEditor事件,该事件在控件转化到可编辑状态前调用,只要设置该事件的参数CancelEventArgs即可
而对于具体是哪一个节点则可以通过TreeList的FocusedNode来获取,而对于是哪一列则可以通过TreeList的FocusedColumn来获取
而我现在的这个项目还要求结合第一列的值来进行判断,那么就通过FocusedNode的GetValue(0)方法来获取第一列的值。
写了这么多还是来看一下代码可能更明白:
private void treeList1_ShowingEditor(object sender, CancelEventArgs e)
&&&&&&&&&&& TreeList currentTreeList = sender as TreeL
&&&&&&&&&&& if (currentTreeList != null)
&&&&&&&&&&& {
&&&&&&&&&&&&&&& TreeListNode node = currentTreeList.FocusedN
&&&&&&&&&&&&&&& DevExpress.XtraTreeList.Columns.TreeListColumn column = currentTreeList.FocusedC
&&&&&&&&&&&&&&& if (column.FieldName == &ITEM_VALUE& && node.GetValue(0).ToString() != &&)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Cancel =
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& e.Cancel =
&&&&&&&&&&&&&&& }
&&&&&&&&&&& }
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:349102次
积分:4196
积分:4196
排名:第6271名
转载:421篇
评论:18条
(1)(1)(1)(1)(1)(4)(1)(4)(8)(3)(1)(4)(4)(4)(5)(7)(2)(7)(12)(1)(14)(7)(20)(7)(6)(1)(10)(4)(9)(11)(25)(57)(15)(9)(19)(12)(12)(66)(3)(1)(2)(1)(40)(1)(1)Devexpress控件中TreeList的递归绑定数据
Devexpress中的TreeList控件能实现类似于TreeView的功能下面介绍下TreeList递归绑定DataTable中的数据两个表。第一个表是父节点类型,第二个表是每个类型下的子
Devexpress中的TreeList控件能实现类似于TreeView的功能下面介绍下TreeList递归绑定DataTable中的数据 & 两个表。第一个表是父节点类型,第二个表是每个类型下的子节点public void Bind()
this.TreeList.Clear();
DataTable dt="从数据库中查询集合";
if(dt.Rows.Count&0)
TreeListNode node=treelist1.AppendNode("id",NULL);
node.SetValue=(0,"Name");
for(int i=0;i,dt.Rows.Ci++)
TreeListNode nodeTemp=treelist1.AppendNode(dt.Rows[i]["ID"],node);
nodeTemp.SetValue(TreeListClomus1,dt.Rows[i]["Name"]);
nodeTemp.Tag=dt.Rows[i];
GetChildNode(TreeListNode node ,dt.Rows[i]["ID"]);
}public void GetChildNode(TreeListNode node ,string parent)
DataTable dt="从数据库中查询whereID"],node);
nodelist.SetValue(treelistColumns1,dt.Rows[i]["Name"]);
nodelist.Tag=dt.Rows[i];
}本文出自 “技术总结” 博客,,请务必保留此出处
你最喜欢的c# - DevExpress TreeListControl create custom cell template - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 7.0 million programmers, just like you, helping each other.
J it only takes a minute:
I am having trouble binding stuff with
I want to create a custom cell template not the default one. When using the default cell template my binding works. Here is my project:
&Window x:Class="WpfApplication2.MainWindow"
xmlns="/winfx/2006/xaml/presentation"
xmlns:x="/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:dxt="/winfx/2008/xaml/grid" &
&Window.Resources&
&/Window.Resources&
&dxt:TreeListControl Name="treeList"&
&dxt:TreeListControl.Columns&
&!-- Custom Column --&
&dxt:TreeListColumn FieldName="Name" Header="Name"&
&dxt:TreeListColumn.CellTemplate&
&DataTemplate &
&TextBlock Text="{Binding Path=Name}" Foreground="Blue" /&
&/DataTemplate&
&/dxt:TreeListColumn.CellTemplate&
&/dxt:TreeListColumn&
&!-- default Column --&
&dxt:TreeListColumn FieldName="Position" Header="Position"/&
&/dxt:TreeListControl.Columns&
&dxt:TreeListControl.View&
&dxt:TreeListView Name="treeListView1" AutoWidth="True"
KeyFieldName="ID" ParentFieldName="ParentID"/&
&/dxt:TreeListControl.View&
&/dxt:TreeListControl&
Code Behind:
using System.Collections.G
using System.W
using System.Windows.D
namespace WpfApplication2
public partial class MainWindow : Window
public MainWindow ( )
InitializeComponent( );
treeList.ItemsSource = GetStuff( );
treeListView1.ExpandAllNodes( );
public static List&Employee& GetStuff ( )
List&Employee& stuff = new List&Employee&( );
stuff.Add( new Employee( ) { ID = 1 , ParentID = 0 , Name = "Gregory S. Price" } );
stuff.Add( new Employee( ) { ID = 2 , ParentID = 0 , Name = "Irma R. Marshall" } );
stuff.Add( new Employee( ) { ID = 3 , ParentID = 0 , Name = "John C. Powell" } );
stuff.Add( new Employee( ) { ID = 6 , ParentID = 2 , Position = "Brian C. Cowling" } );
stuff.Add( new Employee( ) { ID = 7 , ParentID = 2 , Position = "Thomas C. Dawson" } );
stuff.Add( new Employee( ) { ID = 8 , ParentID = 2 , Position = "Angel M. Wilson" } );
stuff.Add( new Employee( ) { ID = 9 , ParentID = 2 , Position = "Bryan R. Henderson" } );
stuff.Add( new Employee( ) { ID = 10 , ParentID = 3 , Position = "Harold S. Brandes" } );
stuff.Add( new Employee( ) { ID = 11 , ParentID = 3 , Position = "Michael S. Blevins" } );
stuff.Add( new Employee( ) { ID = 12 , ParentID = 3 , Position = "Jan K. Sisk" } );
stuff.Add( new Employee( ) { ID = 13 , ParentID = 3 , Position = "Sidney L. Holder" } );
stuff.Add( new Employee( ) { ID = 14 , ParentID = 1 , Position = "Brian C. Cowling" } );
stuff.Add( new Employee( ) { ID = 15 , ParentID = 1 , Position = "Thomas C. Dawson" } );
stuff.Add( new Employee( ) { ID = 16 , ParentID = 1 , Position = "Angel M. Wilson" } );
stuff.Add( new Employee( ) { ID = 17 , ParentID = 1 , Position = "Bryan R. Henderson" } );
public class Employee
public int ID { }
public int ParentID { }
public string Name { }
public string Position { }
why is it that my (&!-- Custom Column --&) does not display the Name of the employe? what do I have to do to bind it to that Property? If I remove the CellTemplate it works but I want to have my custom style...
8,92545188323
Ok I'm going to answer before Devex Team :)
Change this :
&TextBlock Text="{Binding Path=Name}" Foreground="Blue" /&
&TextBlock Text="{Binding Path=Data.Name}" Foreground="Blue" /&
Or simply :
&TextBlock Text="{Binding Data.Name}" Foreground="Blue" /&
4,42542035
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
rev .25686
Stack Overflow works best with JavaScript enabledDevExpress之TreeList用法实例总结
投稿:shichen2014
字体:[ ] 类型:转载 时间:
这篇文章主要介绍了DevExpress之TreeList用法,对于C#初学者有一定的借鉴价值,需要的朋友可以参考下
本文实例总结了DevExpress之TreeList用法,希望对大家学习C#程序设计起到一定的帮助作用。具体实例如下:
using System.Collections.G
using System.D
using System.Windows.F
using DevExpress.XtraB
using DevExpress.XtraTreeL
using DevExpress.XtraTreeList.N
namespace DevExpressUtilHelpV3
public static class TreeListToolV3
public delegate string BuildPathRule(string nodeText, string fullPathInfo);
/// &summary&
/// 获取选中节点到根节点的所有信息
/// &/summary&
/// &param name="focusedNode"&TreeListNode&/param&
/// &param name="columnID"&列名称&/param&
/// &param name="buildPathRule"&规则委托&/param&
/// &returns&路径信息&/returns&
public static string FullPathInfo(this TreeListNode focusedNode, string columnID, BuildPathRule buildPathRule)
if (focusedNode == null)
throw new ArgumentNullException("focusedNode");
if (string.IsNullOrEmpty("columnID"))
throw new ArgumentNullException("columnID");
string _fullPathInfo = string.E
_fullPathInfo = focusedNode.GetDisplayText(columnID);
while (focusedNode.ParentNode != null)
focusedNode = focusedNode.ParentN
string _nodeText = focusedNode.GetDisplayText(columnID).Trim();
_fullPathInfo = buildPathRule(_nodeText, _fullPathInfo);
return _fullPathI
public delegate bool CompareNodeRule(TreeListNode focusedNode);
/// &summary&
/// 获取筛选节点到根节点的所有信息
/// &/summary&
/// &param name="focusedNode"&TreeListNode&/param&
/// &param name="columnID"&列名称&/param&
/// &param name="compareNodeRule"&规则委托&/param&
/// &param name="buildPathRule"&规则委托&/param&
/// &returns&路径信息&/returns&
public static string FilterPathInfo(this TreeListNode focusedNode, string columnID, CompareNodeRule compareNodeRule, BuildPathRule buildPathRule)
if (focusedNode == null)
throw new ArgumentNullException("focusedNode");
if (string.IsNullOrEmpty("columnID"))
throw new ArgumentNullException("columnID");
string _fullPathInfo = string.E
_fullPathInfo = focusedNode.GetDisplayText(columnID);
while (focusedNode.ParentNode != null)
focusedNode = focusedNode.ParentN
if (compareNodeRule(focusedNode))
string _nodeText = focusedNode.GetDisplayText(columnID).Trim();
_fullPathInfo = buildPathRule(_nodeText, _fullPathInfo);
return _fullPathI
/// &summary&
/// 递归遍历树节点
/// &/summary&
/// &param name="tree"&&/param&
/// &param name="opreateRule"&&/param&
public static void LoopTree(this TreeList tree, Action&TreeListNode& opreateRule)
if (tree == null)
throw new ArgumentNullException("tree");
foreach (TreeListNode node in tree.Nodes)
opreateRule(node);
if (node.Nodes.Count & 0)
LoopTreeNodes(node, opreateRule);
/// &summary&
/// 递归遍历TreeListNode节点
/// &/summary&
/// &param name="node"&&/param&
/// &param name="opreateRule"&&/param&
public static void LoopTreeNodes(this TreeListNode node, Action&TreeListNode& opreateRule)
if (node == null)
throw new ArgumentNullException("node");
foreach (TreeListNode _childNode in node.Nodes)
opreateRule(_childNode);
LoopTreeNodes(_childNode, opreateRule);
/// &summary&
/// 递归遍历TreeListNode,当opreateRule返回false停止循环
/// &/summary&
/// &param name="node"&TreeListNode&/param&
/// &param name="opreateRule"&Func&TreeListNode, bool&&/param&
public static void LoopTreeNodes_Break(this TreeListNode node, Func&TreeListNode, bool& opreateRule)
if (node == null)
throw new ArgumentNullException("node");
foreach (TreeListNode _childNode in node.Nodes)
if (!opreateRule(_childNode))
LoopTreeNodes_Break(_childNode, opreateRule);
/// &summary&
/// 递归遍历TreeListNode,当opreateRule返回false跳出循环,直接进入下次循环
/// &/summary&
/// &param name="node"&TreeListNode&/param&
/// &param name="opreateRule"&Func&TreeListNode, bool&&/param&
public static void LoopTreeNodes_Continue(this TreeListNode node, Func&TreeListNode, bool& opreateRule)
if (node == null)
throw new ArgumentNullException("node");
foreach (TreeListNode _childNode in node.Nodes)
if (!opreateRule(_childNode))
LoopTreeNodes_Continue(_childNode, opreateRule);
public delegate bool CheckNodeRule(TreeListNode fucusedNode);
public delegate void CheckNodeNullRule();
/// &summary&
/// 节点为null检查
/// &/summary&
/// &param name="fucusedNode"&TreeListNode&/param&
/// &param name="checkNodeRule"&若为NULL,处理逻辑&/param&
/// &returns&TreeListNode&/returns&
public static TreeListNode CheckNull(this TreeListNode fucusedNode, CheckNodeNullRule checkNodeRule)
if (fucusedNode == null)
checkNodeRule();
return fucusedN
/// &summary&
/// 正对节点的检查逻辑
/// &/summary&
/// &param name="fucusedNode"&TreeListNode&/param&
/// &param name="checkNodeRule"&检查逻辑代码[委托]&/param&
/// &returns&TreeListNode&/returns&
public static TreeListNode Check(this TreeListNode fucusedNode, CheckNodeRule checkNodeRule)
if (fucusedNode != null)
return checkNodeRule(fucusedNode) == true ? fucusedNode :
/// &summary&
/// 水平滚动条
/// &/summary&
/// &param name="tree"&TreeList&/param&
public static void HorzScroll(this TreeList tree)
if (tree == null)
throw new ArgumentNullException("tree");
tree.OptionsView.AutoWidth =
tree.BestFitColumns();
tree.HorzScrollVisibility = ScrollVisibility.A
/// &summary&
/// 为TreeList附加右键菜单
/// MouseUp(object sender, MouseEventArgs e)事件中调用
/// &/summary&
/// &param name="tree"&TreeList&/param&
/// &param name="e"&MouseEventArgs&/param&
/// &param name="menu"&PopupMenu&/param&
/// &param name="attachMenuRule"&AttachMenuRule&/param&
public static void AttachMenu(this TreeList tree, MouseEventArgs e, PopupMenu menu, Func&TreeListNode, bool& attachMenuRule)
if (tree == null)
throw new ArgumentNullException("tree");
if (menu == null)
throw new ArgumentNullException("menu");
if (e.Button == MouseButtons.Right && Control.ModifierKeys == Keys.None && tree.State == TreeListState.Regular)
Point _point = new Point(Cursor.Position.X, Cursor.Position.Y);
TreeListHitInfo _hitInfo = tree.CalcHitInfo(e.Location);
if (_hitInfo.HitInfoType == HitInfoType.Cell)
tree.SetFocusedNode(_hitInfo.Node);
if (attachMenuRule(tree.FocusedNode))
menu.ShowPopup(_point);
/// &summary&
/// 设置父节点的状态AfterCheckNode(object sender, NodeEventArgs e)
/// &/summary&
/// &param name="node"&&/param&
/// &param name="check"&&/param&
public static void ProcessNodeCheckState(this TreeListNode node, CheckState check)
if (node == null)
throw new ArgumentNullException("node");
SetCheckedChildNodes(node, check);
SetCheckedParentNodes(node, check);
/// &summary&
/// 设置子节点CheckState
/// &/summary&
/// &param name="node"&&/param&
/// &param name="check"&&/param&
private static void SetCheckedChildNodes(TreeListNode node, CheckState check)
if (node != null)
node.LoopTreeNodes((TreeListNode _node) =&
_node.CheckState =
/// &summary&
/// 设置父节点CheckState
/// &/summary&
/// &param name="node"&&/param&
/// &param name="check"&&/param&
private static void SetCheckedParentNodes(TreeListNode node, CheckState check)
if (node.ParentNode != null)
bool _checkStatus =
CheckState _nodeS
node.LoopTreeNodes_Break((TreeListNode _node) =&
_nodeState = _node.CheckS
if (!check.Equals(_nodeState))
_checkStatus = !_checkS
//跳出循环
//继续循环
node.ParentNode.CheckState = _checkStatus ? CheckState.Indeterminate :
SetCheckedParentNodes(node.ParentNode, check);
/// &summary&
/// 根据CheckState获取TreeListNode
/// &/summary&
/// &param name="tree"&TreeList&/param&
/// &param name="state"&CheckState&/param&
/// &param name="GetNodesByStateRule"&返回True的时候继续&/param&
/// &returns&TreeListNode集合&/returns&
public static List&TreeListNode& GetNodesByState(this TreeList tree, CheckState state, Func&TreeListNode, bool& GetNodesByStateRule)
if (tree == null)
throw new ArgumentNullException("tree");
List&TreeListNode& _checkNodes = new List&TreeListNode&();
tree.LoopTree((TreeListNode node) =&
if (GetNodesByStateRule(node))
if (node.CheckState == state)
_checkNodes.Add(node);
return _checkN
本文实例备有详尽的注释,可以帮助大家更好的加以理解。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具

我要回帖

更多关于 version svn 使用 的文章

 

随机推荐