【问题标题】:XtraTreelist selection issue, mutliple unexpected events triggeredXtraTreelist 选择问题,触发了多个意外事件
【发布时间】:2011-01-25 05:37:14
【问题描述】:

我有一个带有复选框的树状列表供选择。

我已经为这个列表附加了一个事件,该事件在数据源或任何值发生更改时触发。

当我点击复选框时,事件会触发,这很好 但是当我只是点击行(而不是复选框)时,仍然会触发事件。

我希望仅在我单击复选框时触发。

是否有任何属性可以设置为触发仅在复选框单击期间发生?

【问题讨论】:

    标签: xtratreelist


    【解决方案1】:

    尝试使用 RepositoryItemCheckEdit 中的事件:

    this.repositoryItemCheckEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
    this.treeList.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
    this.repositoryItemCheckEdit1});
    //Assign it to your column that will have the checkbox
    this.colwithCheckbox.ColumnEdit = this.repositoryItemCheckEdit1;
    
    //And use the event
    this.colwithCheckbox.ColumnEdit.EditValueChanging +=ColumnEdit_EditValueChanging
    

    在方法之前:

    void ColumnEdit_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
        {
            //You can cancel the check event
            e.Cancel = true;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-14
      • 2013-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-30
      相关资源
      最近更新 更多