-
Notifications
You must be signed in to change notification settings - Fork 22
WPF 弹窗
L edited this page Apr 17, 2020
·
3 revisions
效果:
主窗体打开弹窗ModifyTextDialog
private void ModifyTextClick(object sender, RoutedEventArgs e)
{
ModifyTextDialog dialog = new ModifyTextDialog(myTextBlock.Text);
var r= dialog.ShowDialog();
//得到弹窗返回结果,如果是true
if (r.HasValue && r.Value==true)
{
myTextBlock.Text = dialog.myTextBox.Text;
}
}
窗体事件:
private void OkClick(object sender, RoutedEventArgs e)
{
//设置结果
this.DialogResult = true;
this.Close();
}
private void CancleClick(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
MoveAndResizeControl 的move and rezise TextBlock
文本框,右键“修改文字内容”