Hello.
I use xamDiagram as a simple user viewable canvas where some geometries are placed at some pre-defined position by parsing from files.
When user click a loading button, the geomertries are placed. and It works fine.
Problem is when user click the loading button again after changing the viewport of canvas by doing panning-like action.
I really want to initialize viewport of the canvas so that geometries from the files are well placed according to the positions described in the file.
I tried ScaleToFit() function at the end of the logic in code-behind but It didn't work. (It only works when I call it by command from xaml)
thanks in advanced
Hello James.Jeon
Do you want to reset zoom level and view port rect?If it is the case, store the initial WindowRect beforehand, and restore it when you load shapes, geometries and nodes.And also, call ZoomTo100() method to reset zoom level.
private Rect initialWindowRect;
private void Diagram_Loaded(object sender, RoutedEventArgs e){ initialWindowRect = Diagram.WindowRect;}
private void LoadButton_Click(object sender, RoutedEventArgs e){ /* Write codes to load shapes, geometories, etc. */
Diagram.ZoomTo100(); Diagram.WindowRect = initialWindowRect;}
I hope this will help.
Best regards,
Noriko I.Developer Support EngineerInfragistics, Inc.