当前位置: 首页>>代码示例>>C#>>正文


C# TreeList.ShowEditor方法代码示例

本文整理汇总了C#中TreeList.ShowEditor方法的典型用法代码示例。如果您正苦于以下问题:C# TreeList.ShowEditor方法的具体用法?C# TreeList.ShowEditor怎么用?C# TreeList.ShowEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeList的用法示例。


在下文中一共展示了TreeList.ShowEditor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowFilter

        public static void ShowFilter(
            TreeList treeList, bool readOnly, string idField,
            string idParent, FilterConditionEnum filterCondition)
        {
            object prevalue = null;
            TreeListColumn currentColumn = null;
            bool Flag = false;
            Dictionary<string, object> preValue = new Dictionary<string, object>();
            Dictionary<string, int> indexCondition = new Dictionary<string, int>();

            //Chèn row filter vào treelist
            DataTable dtSource = (DataTable)treeList.DataSource;
            DataRow filterRow = dtSource.NewRow();
            foreach (DataColumn column in dtSource.Columns)
            {
                try
                {
                    if (column.ColumnName != idField && column.ColumnName != idParent)
                    {
                        try
                        {
                            filterRow[column.ColumnName] = "";
                        }
                        catch
                        {
                            filterRow[column.ColumnName] = DBNull.Value;
                        }

                    }
                }
                catch (Exception ex) { PLException.AddException(ex); }
            }
            filterRow[idField] = long.MinValue;
            filterRow[idParent] = long.MinValue;
            dtSource.Rows.InsertAt(filterRow, 0);

            treeList.OptionsBehavior.EnableFiltering = true;
            treeList.OptionsBehavior.AutoSelectAllInEditor = false;
            treeList.OptionsBehavior.Editable = false;
            treeList.OptionsBehavior.EnterMovesNextColumn = true;
            treeList.ExpandAll();

            if (readOnly)
            {
                treeList.AfterFocusNode += delegate(object sender, NodeEventArgs e)
                {
                    if (e.Node.Id == 0)
                        treeList.OptionsBehavior.Editable = true;
                    else
                        treeList.OptionsBehavior.Editable = false;
                };
            }
            else
                treeList.OptionsBehavior.Editable = true;

            treeList.FocusedNodeChanged += delegate(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
            {
                try
                {
                    if (e.Node.Id == 0)
                        treeList.OptionsBehavior.Editable = true;
                    else
                        treeList.OptionsBehavior.Editable = false;
                }
                catch { }
            };
            treeList.FocusedColumnChanged += delegate(object sender, DevExpress.XtraTreeList.FocusedColumnChangedEventArgs e)
            {
                if (Flag)
                {
                    Flag = false;
                    treeList.FocusedColumn = currentColumn;
                    treeList.ShowEditor();
                }
            };
            treeList.ValidateNode += delegate(object sender, ValidateNodeEventArgs e)
            {
                try
                {
                    if (e.Node.Id == 0)
                        e.Valid = true;
                }
                catch { }
            };
            treeList.CellValueChanged += delegate(object sender, DevExpress.XtraTreeList.CellValueChangedEventArgs e)
            {
                try
                {
                    if (e.Node.Id == 0)
                    {
                        Flag = true;
                        currentColumn = e.Column;
                        object value;
                        int index;

                        preValue.TryGetValue(e.Column.FieldName, out value);
                        indexCondition.TryGetValue(e.Column.FieldName, out index);

                        treeList.FilterConditions[index].Value1 = prevalue;
                        treeList.FilterConditions[index].Visible = true;
//.........这里部分代码省略.........
开发者ID:khanhdtn,项目名称:my-fw-win,代码行数:101,代码来源:HelpTreeList.cs


注:本文中的TreeList.ShowEditor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。