好吧,我想在下一个旁边显示两个文本框customMessageBox.所以我编写了两个文本框.如下.我命名soora,并ayath为它.但在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 !",
};
Run Code Online (Sandbox Code Playgroud)
用a container 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 !",
};
Run Code Online (Sandbox Code Playgroud)