我有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。 我如何通过用户操作更改EditorButtons的可见性(或属性Enabled)。 (对于每一行)?