This project is read-only.

Updating ViewMode scale property doesn't reflect changes

Sep 23, 2010 at 12:19 PM

  Sorry a bit silly question, trying implement simple zooming functionallity, but have something missing:
        private void Button_Click(object sender, RoutedEventArgs e)
        {            
            Viewer.ViewMode.Scale += 0.5;                        
        }
  The Viewer doesn't get updated, tried updatelayout, invalidate... no luck.

Sep 23, 2010 at 12:20 PM

You need to assign a new ViewMode instance to the ViewMode property. At this moment, setting viewmode properties alone does not have an effect.

Sep 23, 2010 at 12:46 PM

Tried this approach:

                    Viewer.ViewMode = new ViewMode()
                    {
                            ScaleMode = Viewer.ViewMode.ScaleMode,                            
                            Scale = Viewer.ViewMode.Scale + ((m.ZoomIn) ? 0.25 : -0.25),
                            IsDefault = Viewer.ViewMode.IsDefault
                    };                                                                

It zooms in the right scale but not in the right position (e.g. if you zoom in several times and zoom out you don't go back to the original position).

Sep 23, 2010 at 2:57 PM

Hi Braulio,

That's correct, at this moment you need to assign a new ViewMode instance. Changing the properties of an assigned ViewMode has no effect.

The position change when changing the scale is a bug in the DocumentViewer.

A workitem has been created for both issues.

Thank you for your feedback.