2012-02-26 7 views
1

これは1日中これを試してみましたが、ちょっと研究を中止しました 私は基本的にこのボタンを選択して最初のページの情報を更新する必要があります私はボタンの背後にあるコードがある場合、その式ブレンドdoesntの仕事に更新し、ナビゲーションではないいくつかの理由についてフォームからフォームへのデータの移動Silverlight WP7 Expressionブレンド - SketchFlow

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

     } 

:(

更新:Form2を私がやった

はこのだった

まだ
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

完璧なあなたのコードのスニペットを共有してください。私はあなたの質問から理解して、フォーム1のインスタンスをフォーム2のコンストラクタに渡し、フォーム1の要素をそこから変更することができます。

// 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"; 
} 
+0

本当に申し訳ありませんでした。 – CodeGuru

+0

をコードに追加すると、実際には新しいScreen_1オブジェクトがターゲットのScreen_1オブジェクトと異なることになります。あなたが実際に望むのは、Screen_2のコンストラクタにパラメータとして既存のScreen_1を渡して、Screen_2の要素/プロパティを操作できるようにすることです。 – Bahamut

+0

私はpublic FormTwo(FormOne formOneInstance)でスタックされています { /* initialization etc */ formOne = formOneInstance; } – CodeGuru

関連する問題