Jul 17, 2018

Change button name in GridView using EditingMode in C# Devexpress

//EditingMode = EditForm 버튼 이름 변경
private static void ChangeButtonSize(SimpleButton btn)
{
btn.CalcBestSize();
}

//EditingMode = EditForm 버튼 이름 변경
private static void ChangeButtonCaption(SimpleButton btn)
{
var newUpdateBtnText = "저장";
var newCancelBtnText = "취소";
var btnText = btn.Text;
switch (btnText)
{
case "Update":
btn.Text = newUpdateBtnText;
break;
case "Cancel":
btn.Text = newCancelBtnText;
break;
}
}

//EditingMode = EditForm 버튼 이름 변경
private void gridView_Main_ShowingPopupEditForm(object sender, ShowingPopupEditFormEventArgs e)
{
foreach (Control control in e.EditForm.Controls)
{
if (!(control is EditFormContainer))
{
continue;
}
foreach (Control nestedControl in control.Controls)
{
if (!(nestedControl is PanelControl))
{
continue;
}
foreach (Control button in nestedControl.Controls)
{
if (button is SimpleButton)
{
var simpleButton = button as SimpleButton;
ChangeButtonCaption(simpleButton);
ChangeButtonSize(simpleButton);
}
}
}
}
}

No comments:

Post a Comment