gpt4 book ai didi

c# - 在 customMessageBox 中显示两个文本框?

转载 作者:太空狗 更新时间:2023-10-29 22:59:55 25 4
gpt4 key购买 nike

好吧,我想在 customMessageBox 中的 next 旁边显示两个文本框。所以我已经为两个文本框编码了。像下面。我为它命名为 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 !",
};

最佳答案

使用容器控件来容纳两个文本框

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 !",
};

关于c# - 在 customMessageBox 中显示两个文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18223977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com