簡體   English   中英

將數據從窗體移動到窗體Silverlight WP7表達式混合-SketchFlow

[英]Moving data from Form to Form Silverlight WP7 Expression blend - SketchFlow

我已經嘗試了整整一天,有點放棄研究,我基本上需要做的是在選擇form2上的此按鈕后更新第一頁上的信息

我所做的是:

private void btnContinue_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // TODO: Add event handler implementation here.

            Screen_1 S1 = new Screen_1();
            S1.CO2.Text = "TEXT";
            S1.CO3.Visibility = Visibility.Visible;
            //NavigationService.Source=new Uri("/Screen_1.xaml", UriKind.Relative);
            //NavigationService.Navigate(new Uri("/Screen_1.xaml", UriKind.Relative));

        }

由於某些原因,如果我在按鈕后面有代碼,則它的不更新和對表達式混合的導航不起作用:(

更新:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Expression.Prototyping.WindowsPhone.Mockups;
using System.Windows.Navigation;

namespace Analyser2_v1Screens
{
    public partial class Select : WindowsPhoneChrome
    {
        Screen_1 formOne = null;

        public Select()
        {
            // Required to initialize variables
            InitializeComponent();

        }

        public Select(Screen_1 formOneInstance)
        {
            // Required to initialize variables
            InitializeComponent();
            formOne = formOneInstance;

        }


        private void clickedC(object sender, System.Windows.RoutedEventArgs e)
        {
            // TODO: Add event handler implementation here.
            //Screen_1 S1 = new Screen_1();
            //  S1.CO2.Content = "This is string content of a Button";
            //  S1.CO3.Visibility = Visibility.Visible;
            //  S1.test1.Text = "Tet";
            //NavigationService.Source=new Uri("/Screen_1.xaml", UriKind.Relative);
            //NavigationService.Navigate(new Uri("/Screen_1.xaml", UriKind.Relative));

            formOne.test1.Text ="test";


        }


    }
}

還不夠完善

請分享您的代碼片段。 據我了解,您可以將表單1的實例傳遞給表單2的構造函數,並從那里更改form1的元素。

// form 1 var
FormOne formOne = null;

// form 2's constructor
public FormTwo(FormOne formOneInstance)
{
   /*initialization etc*/
   formOne = formOneInstance;
}

// some method to alter an element in form 1
private void AlterSomthingInFormOne()
{
   formOne.SomeString = "Whatever value you'll need";
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM