If you are creating a new view and then want to use the UIView.Zoom method, you need to make the new view the active view and then refresh the view. If you don’t, the attempt to zoom will be futile.
public void createNewViewAndZoom()
{
Document doc = this.ActiveUIDocument.Document;
UIDocument uidoc = this.ActiveUIDocument;
ViewFamilyType vft3d = new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)).Cast<ViewFamilyType>().FirstOrDefault(q => q.ViewFamily == ViewFamily.ThreeDimensional);
View view = null;
using (Transaction t = new Transaction(doc, "make views"))
{
t.Start();
view = View3D.CreateIsometric(doc, vft3d.Id);
t.Commit();
}
zoom(uidoc, view);
}
private void zoom(UIDocument uidoc, View view)
{
// YOU NEED THESE TWO LINES OR THE ZOOM WILL NOT HAPPEN!
uidoc.ActiveView = view;
uidoc.RefreshActiveView();
UIView uiview = uidoc.GetOpenUIViews().Cast<UIView>().FirstOrDefault(q => q.ViewId == view.Id);
uiview.Zoom(5);
}