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.
Unfortunately, activation email could not send to your email. Please try again.

Custom editor property grid memory leak

Thread ID:

Created:

Updated:

Platform:

Replies:

103653 May 22,2012 06:39 AM May 25,2012 12:55 AM Silverlight 1
loading
Tags: Tools
Aishwaria
Asked On May 22, 2012 06:39 AM

Hi,

 

                I’m using Syncfusion custom editor to bind to the property grid. Please find the code below,

 

Code snippet:

 

public class eFormColorEditor : ITypeEditor

    {

        private ColorPickerSelector brushSelector;

        #region ITypeEditor Members

 

        public void Attach(PropertyViewItem property, PropertyItem info)

        {

            if (info.CanWrite)

            {

                var binding = new Binding("Value")

                {

                    Mode = BindingMode.TwoWay,

                    Source = info,

                    ValidatesOnExceptions = true,

                    ValidatesOnDataErrors = true,

                    Converter = new ColorToBrushTypeConverter()

                };

                BindingOperations.SetBinding(brushSelector, ColorPickerSelector.SelectedColorProperty, binding);

            }

            else

            {

                var binding = new Binding("Value")

                {

                    Mode = BindingMode.OneWay,

                    Source = info,

                    ValidatesOnExceptions = true,

                    ValidatesOnDataErrors = true,

                    Converter = new ColorToBrushTypeConverter()

                };

                BindingOperations.SetBinding(brushSelector, ColorPickerSelector.SelectedColorProperty, binding);

            }

 

        }       

 

        public object Create(System.Reflection.PropertyInfo PropertyInfo)

        {

            brushSelector = new ColorPickerSelector();

            return brushSelector;

        }       

 

        public void Detach(PropertyViewItem property)

        {           

        }

 

        #endregion

    }

 

    public class ColorToBrushTypeConverter : IValueConverter

    {

        #region IValueConverter Members

 

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            if (value != null && value is SolidColorBrush)

            {

                return (value as SolidColorBrush).Color;

            }

            return value;

        }

 

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

            if (value != null)

            {

                return new SolidColorBrush((Color)value);

            }

            return value;

        }

 

        #endregion

    }

 

In ColorPickerSelector class, I have used a colorpickerpalette to select the color.

When I dispose the control, I notice that the ColorPickerSelector and  ColorToBrushTypeConverter object is retained in the memory.

I’m facing some memory leak issues due to this. I face this issue with other custom editors as well.

 

I would like to know if the object is retained in the memory, if so how do I release the object.

Karthikeyan L [Syncfusion]
Replied On May 25, 2012 12:55 AM

Hi Aishwaria,

Could you please follow up this query through the incident, which is logged in our Direct-trac support system, under the Incident id #94684.

Please let us know if you have any concern.

Regards,
Karthikeyan

CONFIRMATION

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.

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.

;