保存的点将传递给另一个.xaml页面并显示在canvas.children上

时间:2011-08-19 15:31:45

标签: c# windows-phone-7

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();
    }
}
}

所以我需要能够传递列表中的所有点并在画布的下一页上重新绘制它们,如何在不改变我已经拥有的代码的情况下这样做呢?

1 个答案:

答案 0 :(得分:0)

创建页面共享的静态类并将对象放在其中