GridView FocusedRowChanged - 子类对象

发布于 2024-11-03 06:45:39 字数 968 浏览 1 评论 0原文

我这里需要一些帮助。

我从 DevExpress EditorRow 创建了一个名为 MyEditorRow 的子类,并添加了 3 个属性。

public class myEditorRow : EditorRow
    {
        public myEditorRow()
        {
        }

        private string inRowDescription = null;
        public string RowDescription
        {
            get { return inRowDescription; }
            set { inRowDescription = value; }
        }

        private bool inRequired = false;
        public bool Required
        {
            get { return inRequired; }
            set { inRequired = value; }
        }

        private bool inInherits = false;
        public bool Inherits
        {
            get { return inInherits; }
            set { inInherits = value; }
        }

程序中某处代码的第二部分将 MyEditorRow 的实例添加到 DevExpress VGrid Control。

vgcGrid.Rows.Add(Row);

我的问题是:如何将 MyEditorRow 类与 DevExpress VGrid Control FocusedRowChanged 事件链接起来,以便在行焦点更改时获取自定义属性。

谢谢

I need some help here.

I've created a child class called MyEditorRow from DevExpress EditorRow, and added 3 properties

public class myEditorRow : EditorRow
    {
        public myEditorRow()
        {
        }

        private string inRowDescription = null;
        public string RowDescription
        {
            get { return inRowDescription; }
            set { inRowDescription = value; }
        }

        private bool inRequired = false;
        public bool Required
        {
            get { return inRequired; }
            set { inRequired = value; }
        }

        private bool inInherits = false;
        public bool Inherits
        {
            get { return inInherits; }
            set { inInherits = value; }
        }

Second part of the code somewhere in the program adds instance of MyEditorRow to DevExpress VGrid Control.

vgcGrid.Rows.Add(Row);

My question is this: How can I link MyEditorRow class with DevExpress VGrid Control FocusedRowChanged event, so I can get my custom properties when row focus changes.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掩耳倾听 2024-11-10 06:45:40

e.Row 参数为 BaseRow 类型。因此,要在 FocusnedRowChanged 事件处理程序中获取 MyEditorRow 对象的实例,请使用以下代码:

private void vGridControl1_FocusedRowChanged(object sender, DevExpress.XtraVerticalGrid.Events.FocusedRowChangedEventArgs e) {
    if(e.Row is myEditorRow) {
        myEditorRow row = ((myEditorRow)e.Row);
        // your code here
    }       
}

The e.Row parameter is of the BaseRow type. So, to obtain an instance of the MyEditorRow object in the FocusnedRowChanged event handler, use the following code:

private void vGridControl1_FocusedRowChanged(object sender, DevExpress.XtraVerticalGrid.Events.FocusedRowChangedEventArgs e) {
    if(e.Row is myEditorRow) {
        myEditorRow row = ((myEditorRow)e.Row);
        // your code here
    }       
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文