2014-02-06 101 views
0

更改RepositoryItemButtonEdit中的可见性按钮我有3列的gridView。一列已经repositoryItempictureEdit与4个EditorButtons通过点击

this.repActionsBtn.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { 
      new DevExpress.XtraEditors.Controls.EditorButton(), 
      new DevExpress.XtraEditors.Controls.EditorButton(), 
      new DevExpress.XtraEditors.Controls.EditorButton(), 
      new DevExpress.XtraEditors.Controls.EditorButton()}); 

,我有一个ButtonClick事件处理程序

private void repActionsBtn_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) 
     { 
      ButtonEdit editor = sender as ButtonEdit; 

      if (editor != null) 
      { 
       object obj = this.mainView.GetFocusedRow(); 
       int id = GetValueFromAnonymousType<int>(obj, "ID"); 

       //undo 
       if (e.Button == editor.Properties.Buttons[0]) 
       { 
        _ignoredIds.Remove(id); 
       } 
       //delete 
       else if (e.Button == editor.Properties.Buttons[1]) 
       { 
        //HERE i want change visibility buttons 
        e.Button.Visibility = false; 
        _ignoredIds.Add(id); 

       } 
       //edit 
       else if (e.Button == editor.Properties.Buttons[2]) 
       { 
        _storedIds.Clear(); 
        _storedIds.Add(id); 
        this.DialogResult = System.Windows.Forms.DialogResult.Retry; 
       } 
       //save 
       else if (e.Button == editor.Properties.Buttons[3]) 
       { 
        //save 
        _storedIds.Remove(id); 
       } 
       mainView.RefreshRow(this.mainView.FocusedRowHandle); 
      } 
     } 

但火灾重绘和我得到的按钮默认repositoryItemButtonEdit是可见的。 我如何通过用户操作更改EditorButton的可见性(或属性Enabled)。 (对于每一行)?

回答

0

Devexpress支持给我一个解决方案。 Here你可以找到解决方案并下载测试项目。

+0

不,它不工作 –

+0

但它的解决方案正在为我工​​作。你是否已经下载并使用解决方案开始测试项目? – isxaker

+0

我想要做的是当按下RepositoryItem时,它应该从启用更改为禁用。反之亦然。我的意思是使用RepositoryItemButtonEdit切换按钮。 –