访问RepositoryItemTimeSpanEdit的Ok / Accept或Cancel按钮? [英] Access to the Ok/Accept Or Cancel Button of a RepositoryItemTimeSpanEdit?
问题描述
我需要知道有没有办法访问 RepositoryItemTimeSpanEdit
内的按钮的事件。
图像查看按钮我需要的事件:点击
图像
I need to know if there is a way to access to the events of the buttons inside a RepositoryItemTimeSpanEdit
.
Image to see the buttons I need the events for: Click
Image
我试图访问 PopUp
事件和 QueryPopUp
,但是我无法以任何方式获得按钮。
I have tried to access in the PopUp
event and QueryPopUp
, however I can't get the button in any way yet.
推荐答案
您可以获取此表单通过 Popup
事件中的 Form.OwnedForms
属性。这种形式的类型是 DevExpress.XtraEditors.Popup.TimeSpanEditDropDownForm
,所以你只需要找到这种类型的形式。之后,您可以使用 TimeSpanEditDropDormForm.OkButton
属性和 TimeSpanEditDropDownForm.CloseButton
属性访问按钮。
这是一个例子:
You can get this form through Form.OwnedForms
property in Popup
event. The type of this form is DevExpress.XtraEditors.Popup.TimeSpanEditDropDownForm
, so you need just to find the form of this type. After that you can access buttons by using TimeSpanEditDropDownForm.OkButton
property and TimeSpanEditDropDownForm.CloseButton
property.
Here is example:
private void repositoryItemTimeSpanEdit1_Popup(object sender, EventArgs e)
{
var popupForm = (TimeSpanEditDropDownForm)OwnedForms.FirstOrDefault(item => item is TimeSpanEditDropDownForm);
if (popupForm == null)
return;
popupForm.OkButton.Click += OkButton_Click;
popupForm.CloseButton.Click += CloseButton_Click;
}
private void OkButton_Click(object sender, EventArgs e)
{
MessageBox.Show("Ok");
}
private void CloseButton_Click(object sender, EventArgs e)
{
MessageBox.Show("Cancel");
}
这篇关于访问RepositoryItemTimeSpanEdit的Ok / Accept或Cancel按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!