首页 > 解决方案 > C# 获取选定的 IGridDataRow 值桌面应用程序

问题描述

在我的 WindowsForms 项目中,我有一个带有 CellEditor 的类(IGridDataRow 行),我想获取所选项目的值并将其传递给另一个类。

namespace Projects.test.Gui
{
    [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
    public class testAttribute : Attribute, IEditorAttribute
    {
        public CellEditor GetEditor(IGridDataRow row)
        {
            try
            {
                List<string> Names = new List<string>();
                Helper Helper = new Helper();
                Namesdata[] mNames = Helper.FindAllNames();

                if (mNames != null)
                {
                    Names = mNames.Select(mName => mName.Name).ToList();
                }

                return new ButtonEditor(Names);
            }
            catch (Exception ex)
            {
                LogService.LogError(ex.Message);
                return null;
            }
        }

标签: c#winforms

解决方案


推荐阅读