Question

I have create a CustomMessageBox like this:

 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();

I want to retrieve the textbox content, how can I do that ?

Thanxs

Was it helpful?

Solution

You already have a reference to the TextBox, so where is the issue?

mb.Dismissed += (e1, e2) =>
{
    System.Diagnostics.Debug.WriteLine(tbName.Text);
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top