更新其他表单的数据。 [英] Updating data of the other form.
问题描述
大家好!我在按下按钮后尝试以另一种形式更新数据,但由于某种原因它不会更新
private void clickedC(对象发送者,系统。 Windows.RoutedEventArgs e)
{
// TODO:在这里添加事件处理程序实现。
Screen_1 S1 = new Screen_1();
S1.CO2.Content ="这是一个Button的字符串内容" ;;
S1.CO3.Visibility = Visibility.Visible;
S1.test1.Text =" Tet"; $
}
Hello guys! I'm trying to update the data in another form after pressing onto the button but for some reason it wont update
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";
}
我意识到新问题是&使用System尝试了这个&b;
I realise the New was the problem & Tried this
不能正常工作
推荐答案
这不起作用,因为它们是对象的单独实例("new"像你说的)。您可能需要使用静态成员或使用类似数据行为的方法进行调查。更高级的技术将包括一个MVVM设置,其中
是一个用于多个屏幕/表单的VM。
This won't work because they are separate instances of the object ("new" like you said). You will likely need to investigate using static members or using something like the datastate behaviors. More advanced techniques would include a MVVM setup with a VM that is used in multiple screens/forms.
这篇关于更新其他表单的数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!