- Home
- Forum
- Silverlight
- Custom editor property grid memory leak
Custom editor property grid memory leak
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.
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
- 1 Reply
- 2 Participants
-
AI Aishwaria
- May 22, 2012 10:39 AM UTC
- May 25, 2012 04:55 AM UTC