2011-08-19 3 views
0
using System; 
using System.Collections.Generic; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using Microsoft.Phone.Controls; 

namespace MobileElite 
{ 
public partial class signature : PhoneApplicationPage 
{ 
    private Polyline _lineBeingDrawn; 
    private List <Point> _points = new List<Point>(); 
    public signature() 
    { 
     InitializeComponent(); 
    } 

    private void Canvas_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e) 
    { 
     // Here we want to simply add the points information to the list of points we 
     // are capturing in order to redraw this later if needed. 
     foreach (Point p in _points) 
     { 
      _points.ToList<Point>(); 
     } 
     //_points.Add(_lineBeingDrawn.Points); 
    } 

    private void Canvas_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e) 
    { 
     // Here we are adding new points to the PolyLine we created and added as a child 
     // in the Started event above 
     _lineBeingDrawn.Points.Add(new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y)); 
    } 

    private void Canvas_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e) 
    { 
     // Here we want to start our new line for drawing and we want to 
     // add the polyline as a child item to the SignatureCanvas. 
     _lineBeingDrawn = new Polyline 
     { 
      Stroke = new SolidColorBrush(Colors.Black), 
      StrokeThickness = 6.5, 
      Points = new PointCollection { new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y) } 
     }; 


     SignatureCanvas.Children.Add(_lineBeingDrawn); 
    } 

    private void Button_Click(object sender, RoutedEventArgs e) 
    { 
     //Submit Button Click Handling 

    } 

    private void Button_Click_1(object sender, RoutedEventArgs e) 
    { 
     SignatureCanvas.Children.Clear(); 
    } 
} 
} 
그래서 목록에있는 모든 지점을 통과하고 캔버스에 다음 페이지를 다시 그릴 수 있어야합니다

또 다른 .xaml 페이지와 디스플레이로 전달되는 내가 이미 가지고있는 많은 코드를 변경하지 않고 어떻게 그렇게 할 것인가?포인트, canvas.children

답변

0

페이지에서 공유하는 정적 클래스를 만들고 그 안에 개체를 넣으십시오.