Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Created Unassigned: Memory leak with Zoombox Keybindings [20654]

$
0
0
I have detect a memory leak in the zoombox component. I have see through Ants profiler that the control is kept in memory by its keybindings even if the control is not in the visual tree.

I have made a small test to reproduce this behaviour :
* Build a windows like this :
```
<Window x:Class="ZoomboxTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpftoolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<Button Content="Click Me" Click="Button_Click"/>
<ContentControl x:Name="Control">
<wpftoolkit:Zoombox/>
</ContentControl>
</StackPanel>
</Window>
```
* Change the Control content when the button is clicked :
```
private void Button_Click(object sender, RoutedEventArgs e)
{
Control.Content = new Button();
}
```

The quick and dirty turnaround that i have found is to clear the CommandBinding collection before removing the control from the visual tree

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>