You can achieve that issue by giving a little margin to AutoFit() method. It has two optional parameters;
-Thickness margin => margin between diagram shapes and the host window
-bool useAnimation => ( autofit animation )
sender, RoutedEventArgs e)
Here is the 5 value specifies a little margin. You can use that to fit your needs.