Exemple #1
0
        // Displays the UI for value selection.
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // Return the value if the value is not of type Int32, Double and Single.
            //if (value.GetType() != typeof(double) && value.GetType() != typeof(float) && value.GetType() != typeof(int))
            //	return value;

            // Uses the IWindowsFormsEditorService to display a
            // drop-down UI in the Properties window.
            var edSvc = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService));
            if (edSvc != null)
            {
                // Display an angle selection control and retrieve the value.
                var dropDown = new LanguagePropertyChecker(context.Instance, (string) value);
                edSvc.DropDownControl(dropDown);

                return dropDown.FinalValues;
            }
            return value;
        }
        // Displays the UI for value selection.
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // Return the value if the value is not of type Int32, Double and Single.
            //if (value.GetType() != typeof(double) && value.GetType() != typeof(float) && value.GetType() != typeof(int))
            //	return value;

            // Uses the IWindowsFormsEditorService to display a
            // drop-down UI in the Properties window.
            var edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                // Display an angle selection control and retrieve the value.
                var dropDown = new LanguagePropertyChecker(context.Instance, (string)value);
                edSvc.DropDownControl(dropDown);

                return(dropDown.FinalValues);
            }
            return(value);
        }