Esempio n. 1
0
        public override object ConvertTo(ITypeDescriptorContext context,
                                         CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string) && value is PropertySorting)
            {
                PropertySorting pb = value as PropertySorting;
                return(pb.ToString());
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Esempio n. 2
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pri = iri.GetPRI();

            PropertySorting pb = value as PropertySorting;

            if (pb == null)
            {
                return(base.EditValue(context, provider, value));
            }

            using (SingleCtlDialog scd = new SingleCtlDialog(pri.DesignCtl, pri.Draw, pri.Nodes,
                                                             SingleCtlTypeEnum.SortingCtl, null))
            {
                // Display the UI editor dialog
                if (editorService.ShowDialog(scd) == DialogResult.OK)
                {
                    // Return the new property value from the UI editor form
                    return(new PropertySorting(pri));
                }

                return(base.EditValue(context, provider, value));
            }
        }