到現在爲止,我只需要在堆疊面板上顯示一些複選框。因此,我以動態插入文本框
的步驟來構建複選框的內容。
public void addAlarmcl(string argComparator, string value, string argColor)
{
if ((!string.IsNullOrEmpty(argComparator)) && (!string.IsNullOrEmpty(value)) && (!string.IsNullOrEmpty(argColor)))
{
//hexadecimal of color chosen
Color color = (Color)ColorConverter.ConvertFromString(argColor);
//this is to be displayed in stackpenl
string TheOneYouJustBuilt = "If statistics are /" + argComparator + "/" + value + "/ ,notify by /" + color + "/.";
addToStackPanel(TheOneYouJustBuilt);
}
}
,然後將其添加到堆棧面板
//this will display the built alarms on the stackpanel
public void addToStackPanel(string argBuiltAlarm)
{
CheckBox checkQueries = new CheckBox() { Content = argBuiltAlarm };
stackPanel1.Children.Add(checkQueries);
AlarmList.Add(checkQueries);
//storing the built queries alongside FOR DELETION (OR OTHER REFERENCES)
AlarmThatIsBeingDisplayed.Add(argBuiltAlarm.ToString());
}
但現在我需要一個文本框在複選框結束content.How修改我的代碼添加一個文本框?
我知道,聲明一個新的文本框,我們做
var textbox = new TextBox();
//thn we set its properties and all
但我怎麼剛剛複選框內容之後追加了嗎?
解決方案。他的作品非常棒。特克斯。在一分鐘內+1。 –