我已经创建了一个像这样的CustomMessageBox:
TextBox tbName = new TextBox();
tbName.Text = "test";
tbName.Name = "tbName";
Grid grid = new Grid();
grid.Children.Add(tbName);
grid.Name = "grid";
CustomMessageBox mb = new CustomMessageBox()
{
Caption = "test",
Message = "message",
Content = grid,
LeftButtonContent = "ok",
RightButtonContent = "cancel"
};
mb.Dismissed += (e1, e2) =>
{
//how to get textbox text ?
};
mb.Show();
我想检索文本框内容,我该怎么做?
Thanxs
答案 0 :(得分:2)
您已经有对TextBox的引用,那么问题出在哪里?
mb.Dismissed += (e1, e2) =>
{
System.Diagnostics.Debug.WriteLine(tbName.Text);
};