110,535
社区成员
发帖
与我相关
我的任务
分享
<UserControl x:Class="SilverlightApplicationStudy.OutForm.FormApplication"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<StackPanel Orientation="Horizontal">
<Button x:Name="formtest" Content="OutPutForm" Width="100" Height="30"
Background="DarkViolet" Click="formtest_Click" FontSize="14"></Button>
</StackPanel>
</Grid>
</UserControl>
private void formtest_Click(object sender, RoutedEventArgs e)
{
FormChildWin formChildwin = new FormChildWin();
formChildwin.Show();
}
<controls:ChildWindow x:Class="SilverlightApplicationStudy.OutForm.FormChildWin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
Title="FormChildWin"
Width="400" Height="300">
<stackPanel>
<TextBox x:Name="kaisei" Text="2010年12月25日" Width="200" Height="20" TextAlignment="Left"
Foreground="DeepPink"></TextBox>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="0" />
<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="0" />
</stackPanel>
private void formtest_Click(object sender, RoutedEventArgs e)
{
FormChildWin formChildwin = new FormChildWin();
formChildwin.Show();
formChildwin.Closed += new EventHandler(formChildwin_Closed);
}
private void formChildwin_Closed(object sender, EventArgs e)
{
TextBox textBoxOfChildWindow= sender as TextBox;
if(textBoxOfChildWindow!=null)
{
string text=texBoxOfChildWindow.kaisei.Text;
}
}