<Window x:Class="WpfApplication1.View.TestTextBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:vm="clr-namespace:WpfApplication1.ViewModel"
Title="TestTextBox" Height="300" Width="300">
<Window.DataContext>
<vm:TestTextBoxModel/>
</Window.DataContext>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding TestTextBoxCmd}" CommandParameter="{Binding ElementName=TestTextBoxXaml}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid>
<TextBox Height="23" HorizontalAlignment="Left" Margin="60,51,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Text="222"></TextBox>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="62,128,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
</Grid>
</Window>补充 这是 w2 页面 的代码
p2.textboxc.text=