We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set accessor for Panel type browsable property with custom editor

Thread ID:




29885 Jun 6,2005 12:02 PM UTC WinForms 0
Tags: FAQ
Asked On June 6, 2005 12:02 PM UTC

Hi experts I''ve created a custom UITypeEditor and associated the Editor to a property of type Panel for an user control and created. It works fine with Get accessor and open my Editor form.But while try to give a Set accessor for the prioperty, the property edit style has been changed to Drop-Down list. I wonder how this is happening. public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { if (context != null && context.Instance != null) { return UITypeEditorEditStyle.Modal; } return base.GetEditStyle(context); } public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { if( value.GetType() != typeof(Panel)) return value; object originalValue=value; _context=context; edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { AssemblyEditorForm collEditorFrm= new AssemblyEditorForm(); //CreateForm(); collEditorFrm.ItemChanged +=new HCLT.E95UI.BaseFramework.AssemblyEditorForm.InstanceEventHandler(collEditorFrm_ItemChanged); collEditorFrm.ContentPanel =(System.Windows.Forms.Panel) value; context.OnComponentChanging(); collEditorFrm.ShowDialog(); if(collEditorFrm.Result==DialogResult.OK) { MessageBox.Show(collEditorFrm.Result.ToString()); OnCollectionChanged(context.Instance, collEditorFrm.ContentPanel); context.OnComponentChanged(); MessageBox.Show(collEditorFrm.ContentPanel.Name); return collEditorFrm.ContentPanel; } } } //MessageBox.Show (collEditorFrm.ContentPanel.Name ); return value; } private void ItemAdded(object sender, object item) { if(_context!=null && _context.Container!=null) { IComponent icomp=item as IComponent; if(icomp !=null ) { _context.Container.Add (icomp) ; } } } private void ItemRemoved(object sender, object item) { if(_context!=null && _context.Container!=null) { IComponent icomp=item as IComponent; if(icomp!=null) { _context.Container.Remove(icomp); } } } protected virtual void OnCollectionChanged(object instance ,object value) { if(CollectionChanged !=null) { CollectionChanged(this, instance,value); } } protected virtual AssemblyEditorForm CreateForm() { return new AssemblyEditorForm(); } private void collEditorFrm_ItemChanged(object sender, Panel instance) { if(_context!=null && _context.Container!=null) { if(instance!=null ) { _context.PropertyDescriptor.SetValue(this, instance); } } } Thanks, Arun M


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon