• 认为Devexpress TreeList控件的Bug...


    在运用Devexpress过程中发现一个自己认为是Devexpress控件TreeList的Bug。

    涉及到三个事件的执行的理解:BeforeCollapse(展开之前),BeforeFocusNode(获得焦点之前),AfterFocusNode(获得焦点之后)。

    正常的理解:BeforeFocusNode执行完在CanFocus是True的情况下就执行AfterFocusNode。

    当点击了TreeList节点前面的-号(收缩)【实际触发的是BeforeCollapse这个事件】后,BeforeFocusNode执行完在CanFocus是True的情况下执行AfterFocusNode。

    个人理解,有误请指正!

    View Code
     1         /// <summary>
    2 /// 获得焦点之前
    3 /// </summary>
    4 /// <param name="sender"></param>
    5 /// <param name="e"></param>
    6 private void basicTreeView1_BeforeFocusNode(object sender, DevExpress.XtraTreeList.BeforeFocusNodeEventArgs e)
    7 {
    8 if ( ViewIndex == 1&&!this.InvokeRequired)
    9 {
    10 if (rightPanel.Controls.Count == 0) return;
    11 if (e.Node == basicTreeView1.FocusedNode) return;
    12 if ((rightPanel.Controls[0] as IMain).DataChangs())
    13 {
    14 DialogResult ret = XtraMessageBox.Show(Resources.Multilingual.String[Constant.MultilingualField.DataChangsTip], Resources.Multilingual.String[Constant.MultilingualField.MissageTitle], MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
    15 if (ret == DialogResult.Yes)
    16 {
    17 if (((((rightPanel.Controls[0] as UcTabBase).Controls[0] as DevExpress.XtraTab.XtraTabControl).SelectedTabPage).Controls[0] as UcMainInfomationBase).SaveData())
    18 ;//(rightPanel.Controls[0] as IMain).Save();
    19 else
    20 {
    21 e.CanFocus = false;
    22 }
    23 }
    24 }
    25 }
    26 }
    27 /// <summary>
    28 /// 获得焦点之后
    29 /// </summary>
    30 /// <param name="sender"></param>
    31 /// <param name="e"></param>
    32 private void basicTreeView1_AfterFocusNode(object sender, DevExpress.XtraTreeList.NodeEventArgs e)
    33 {
    34 if (DisplayDataList)
    35 SetRzGraphParameter(e.Node);
    36 if (ViewIndex == 1)
    37 {
    38 MD_ConfigurationTree treeNode = NodeConversionModel(e.Node);
    39 DataRow dr = (basicTreeView1.GetDataRecordByNode(e.Node) as DataRowView).Row;
    40 DataSet dsData = dr.Table.DataSet.Clone();
    41 dsData.Tables[0].ImportRow(dr);
    42 dsData.AcceptChanges();
    43 SetConfigurationMode(treeNode, dsData);
    44
    45 if (DisplayDataList)
    46 RefreshGraData();//刷新数据
    47 }
    48 }
    49 /// <summary>
    50 /// 收缩之前
    51 /// </summary>
    52 /// <param name="sender"></param>
    53 /// <param name="e"></param>
    54 private void basicTreeView1_BeforeCollapse(object sender, DevExpress.XtraTreeList.BeforeCollapseEventArgs e)
    55 {
    56 if (IsCollapseHigherNode(e.Node,basicTreeView1.FocusedNode))
    57 {
    58 basicTreeView1.FocusedNode = e.Node;
    59 if(!basicTreeView1.HasFocus)
    60 e.CanCollapse = false;
    61 }
    62 }
  • 相关阅读:
    AI:IPPR的数学表示-CNN稀疏结构进化(Mobile、xception、Shuffle、SE、Dilated、Deformable)
    基于视觉的机械手控制
    远程图形界面:VncServer与KDE桌面远程连接
    远程图形界面:使用putty+xmin远程登录ubuntu-kde
    CUDA 显存操作:CUDA支持的C++11
    C++11:using 的各种作用
    C++ 模板template和template
    Detectron:Pytorch-Caffe2-Detectron的一些跟进
    TF实战:(Mask R-CNN原理介绍与代码实现)-Chapter-8
    The type javax.servlet.http.HttpServletRequest cannot be resolved.
  • 原文地址:https://www.cnblogs.com/yalong_xiang/p/2136651.html
Copyright © 2020-2023  润新知