好吧,我想在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 !",
};
答案 0 :(得分:6)
使用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 !",
};
答案 1 :(得分:1)
如果你想显示文字,那么
Content = soora.Text + ayath.Text,