5

好吧,我想在customMessageBox. 所以我为两个文本框编码。如下所示。我sooraayath它命名。但是在customMessageBox,我不能同时调用两个文本框。它显示错误。如何在customMessageBox. 我只有错误,它是形式Content = soora + ayath

我的 C# 代码;

TextBox soora = new TextBox();
                soora.Height = 72;
                soora.Width = 150;
                soora.MaxLength = 3;

TextBox ayath = new TextBox();
                ayath.Height = 72;
                ayath.Width = 150;
                ayath.MaxLength = 3;

CustomMessageBox messageBox = new CustomMessageBox()
            {
                Title = "GO TO",
                Content = soora + ayath,
                RightButtonContent = "Go !",
            };
4

2 回答 2

6

使用 acontainer control来持有两者textboxes

TextBox soora = new TextBox();
                soora.Height = 72;
                soora.Width = 150;
                soora.MaxLength = 3;

TextBox ayath = new TextBox();
                ayath.Height = 72;
                ayath.Width = 150;
                ayath.MaxLength = 3;

StackPanel container = new StackPanel{
                           Orientation = System.Windows.Controls.Orientation.Horizontal
                       };

container.Children.Add(soora);
container.Children.Add(ayath);    

CustomMessageBox messageBox = new CustomMessageBox()
            {
                Title = "GO TO",
                Content = container,
                RightButtonContent = "Go !",
            };
于 2013-08-14T05:51:29.563 回答
1

如果你想显示文本然后

Content = soora.Text + ayath.Text,
于 2013-08-14T05:44:46.933 回答