public ViewImage(string url, string cust_name) { //NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); Title = cust_name; BackgroundColor = Color.Black; Content = new PinchToZoomContainer { Content = new Image { Source = ImageSource.FromUri(new Uri(url)) } }; }
protected override void Init() { var layout = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 80 }, new RowDefinition { Height = GridLength.Star } } }; var scaleLabel = new Label(); layout.Children.Add(scaleLabel); var pinchToZoomContainer = new PinchToZoomContainer { Margin = new Thickness(80), AutomationId = ZoomContainer, Content = new Image { AutomationId = ZoomImage, Source = ImageSource.FromFile("oasis.jpg") } }; Grid.SetRow(pinchToZoomContainer, 1); layout.Children.Add(pinchToZoomContainer); scaleLabel.BindingContext = pinchToZoomContainer; scaleLabel.SetBinding(Label.TextProperty, new Binding("CurrentScale")); Content = layout; }
private void EndPan(PinchToZoomContainer element, float x, float y) { element.OnPanUpdated(this, new PanUpdatedEventArgs(GestureStatus.Completed, 0, x, y)); _panStarted = false; }