private static object CoerceZoom(DependencyObject dependencyObject, object baseValue) { ZoomAndPanImage zoomAndPanImage = (ZoomAndPanImage)dependencyObject; double current = (double)baseValue; if (current < zoomAndPanImage.MinZoom) { current = zoomAndPanImage.MinZoom; } if (current > zoomAndPanImage.MaxZoom) { current = zoomAndPanImage.MaxZoom; } return(current); }
private static object CoercePanX(DependencyObject dependencyObject, object baseValue) { ZoomAndPanImage control = (ZoomAndPanImage)dependencyObject; double current = (double)baseValue; /*Image img = control.ImageContainer; * Border border = control.Border; * double borderWidth = border.RenderSize.Width; * double imgWidth = img.RenderSize.Width; * if (borderWidth > imgWidth) * { * // Image doesn't fill the screen fully * Console.WriteLine($"Image doen't fill screen. imgWidth: {imgWidth} borderWidth: {borderWidth}"); * } * else * { * Console.WriteLine($"Image fills screen. imgWidth: {imgWidth} borderWidth: {borderWidth}"); * }*/ return(current); }