मैं चुटकी ज़ूम और (एक छवि नियंत्रण पर) ManipulationDelta और ManipulationStarted घटनाओं के लिए hooking द्वारा पैनिंग लागू करने के लिए प्रबंधित किया है:चिकना पिंच-ज़ूम और विंडोज फोन पर पैनिंग 8
private void image_OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
var transform = (CompositeTransform)image.RenderTransform;
// pan
transform.TranslateX = _translationX + e.CumulativeManipulation.Translation.X;
transform.TranslateY = _translationY + e.CumulativeManipulation.Translation.Y;
// zoom
if (e.PinchManipulation != null)
{
transform.CenterX = e.PinchManipulation.Original.Center.X;
transform.CenterY = e.PinchManipulation.Original.Center.Y;
transform.ScaleX = _scaleX * e.PinchManipulation.CumulativeScale;
transform.ScaleY = _scaleY * e.PinchManipulation.CumulativeScale;
}
}
private void image_OnManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
// the user has started manipulating the screen, set starting points
var transform = (CompositeTransform)image.RenderTransform;
_scaleX = transform.ScaleX;
_scaleY = transform.ScaleY;
_translationX = transform.TranslateX;
_translationY = transform.TranslateY;
}
लेकिन की तुलना में विंडोज़ फोन यूआई के बाकी हिस्सों की चिकनीता यह बहुत सहज और कठोर महसूस करती है। आंदोलन में कोई जड़ता नहीं है।
क्या आंदोलनों को और अधिक आसान बनाने का कोई तरीका है? एनिमेशन और स्टोरीबोर्ड का उपयोग करने के लिए एक तरीका है? मैंने कम से कम चिकनी पैनिंग प्राप्त करने के लिए स्क्रॉलव्यू का उपयोग करने का प्रयास किया है, लेकिन फिर मैनिपुलेशन डेल्टा घटनाएं सही ढंग से फायरिंग नहीं कर रही हैं।
बस प्रश्न के रूप में एक अद्यतन लोकप्रिय होने लगते हैं को हल करने में मदद कर सकता है: मैं "जड़ता" महसूस करने के लिए प्रोग्रामेटिक रूप से बनाए गए एनिमेशन के साथ संयुक्त उपरोक्त कोड का उपयोग कर समाप्त हुआ। मुझे आसानी से चलाने के लिए, सरल नियंत्रण (कैनवस और बिटमैप कैश छवियों) का उपयोग करके ऑप्टिमाइज़ करना भी था। – Pking
संभावित डुप्लिकेट - अच्छी तरह से यहां समझाया गया। [http://stackoverflow.com/questions/13969400/pinch-to-zoom-functionality-in-windows-phone-8](http://stackoverflow.com/questions/13969400/pinch-to-zoom-functionality- इन-windows-फोन-8) –