iam developing a wpf app and i will enable the pinch to zoom and scrolling feature on a touchscreen.
here is my code
XAML:
and .cs
private void myCanvas_Loaded(object sender, RoutedEventArgs e)
{
try
{
string xpsFilePath = System.IO.Path.GetFullPath("XPS/" + RunViewModel._textToDisplay + ".xps");
XpsDocument myDoc = new XpsDocument(xpsFilePath, FileAccess.Read);
Viewer.Document = myDoc.GetFixedDocumentSequence();
Viewer.FitToHeight();
Viewer.FitToWidth();
test.Height = ActualHeight;
// Viewer.Height = ActualHeight;
//Viewer.Width = ActualWidth;
} catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void myCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
Viewer.Height = (ActualHeight);
Viewer.Width = (ActualWidth);
Viewer.FitToHeight();
test.Height = ActualHeight;
// Viewer.FitToWidth();
}
i added a scrollview, but nothing happend.
What must i add?
Thanks for your help!
Solved
I now use this and everything works!
https://archive.codeplex.com/?p=multitouchtransformbehavior
easy way to use pinch to zoom rotate and scroll!
No comments:
Post a Comment