如何在WPF中从另一个窗口更改控件?我想在另一个窗口中编辑一个文本框。我已经尝试过了:
this.addInRooms(response.data[0].RoomSno,response.data[0].Room_Name);
$scope.roomname = findRoom( response.data[0].RoomSno,response.data[0].Room_Name);
...
this.addInRooms = function(sno, name){
// init your room with its data
var room = {....};
this.rooms.push(room);
}
...
this.findRoom = function(sno, name){
for(var i = 0; i < this.rooms.length; i++){
var currentRoom = this.rooms[i];
if(currentRoom.sno == sno && currentRoom.name == name) {
return currentRoom;
}
}
}
但这不起作用。我希望你能帮忙!
答案 0 :(得分:3)
试试这个:
((MainWindow)Application.Current.MainWindow).textBox1.Text ="test";