Hi,
I get OutOfMemory exceptions when I call the Diagram.ZoomToRect() method when an Overview is used.
Sample project to reproduce my behavior:
Markup:
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<diag:Diagram x:Name="diagram" Grid.Column="0"
Bounds="0, 0, 800, 800"
BackBrush="LightSteelBlue"
NodeDoubleClicked="diagram_NodeDoubleClicked"/>
<StackPanel Orientation="Vertical" Grid.Column="1" >
<diag:NodeListView x:Name="nodeListView" />
<diag:Overview x:Name="diagOverview"></diag:Overview>
<Button Content="Default zoom" Click="Button_Click" />
</StackPanel>
</Grid>
Code behind:
public MainPage()
{
InitializeComponent();
nodeListView.Items.Add(new ShapeNode() { Text = "Node 1" });
nodeListView.Items.Add(new ShapeNode { Text = "Node 2" });
diagOverview.Document = diagram;
}
private void diagram_NodeDoubleClicked(object sender, NodeEventArgs e)
{
diagram.ZoomToRect(e.Node.Bounds);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
diagram.ZoomFactor = 100;
}
If a double-click on a node then click "Default zoom" several times, the memory usage jumps, eventually throwing an OutOfMemory Exception from the Overview.Update() method.
Everything works fine if I comment the following line in the constructor:
diagOverview.Document = diagram;
Thank you!
alex