Exemple #1
0
 void PropertyGrid_CustomPropertyDescriptors(object sender, DevExpress.XtraVerticalGrid.Events.CustomPropertyDescriptorsEventArgs e)
 {
     //if ( e.Source is IABCControl )
     //{
     try
     {
         PropertyDescriptorCollection filteredCollection = new PropertyDescriptorCollection(null);
         Type          type      = e.Source.GetType();
         List <String> lstFilter = ABCPresentHelper.GetUsablePropertiesList(type);
         foreach (PropertyInfo proInfo in e.Source.GetType().GetProperties())
         {
             if (lstFilter.Contains(proInfo.Name) || proInfo.Name.StartsWith("Name_"))
             {
                 if (e.Properties[proInfo.Name] != null)
                 {
                     filteredCollection.Add(e.Properties[proInfo.Name]);
                 }
             }
         }
         e.Properties = filteredCollection;
     }catch (Exception ex)
     {
     }
     //    }
 }
Exemple #2
0
        private void OnCustomPropertyDescriptors(object sender, DevExpress.XtraVerticalGrid.Events.CustomPropertyDescriptorsEventArgs e)
        {
            PropertyGridControl          grid       = sender as PropertyGridControl;
            PropertyDescriptorCollection sourceColl = TypeDescriptor.GetProperties(grid.SelectedObject);
            PropertyDescriptorCollection destColl   = new PropertyDescriptorCollection(null);

            foreach (PropertyDescriptor pd in sourceColl)
            {
                destColl.Add(new MyPropertyDescriptor(pd));
            }
            e.Properties = destColl;
        }
Exemple #3
0
        /// <summary>
        /// 自定义属性描述
        /// </summary>
        private void propertyGridControl1_CustomPropertyDescriptors(object sender, DevExpress.XtraVerticalGrid.Events.CustomPropertyDescriptorsEventArgs e)
        {
            // 最外层
            if (e.Context.PropertyDescriptor == null)
            {
                e.Properties = SetProperty(e.Properties);
            }

            //内层
            if (e.Context.PropertyDescriptor != null)
            {
                e.Properties = SetProperty(e.Properties);
            }
        }