8,757
社区成员
发帖
与我相关
我的任务
分享foreach (AppealInfoDetailItem infoItem in appealInfoDetails)
{
if (infoItem.ID == 1)
{
GroupBox gpBox=new GroupBox();
TextBlock txb = new TextBlock();
txb.Text = infoItem.ID.ToString();
gpBox.Content = txb;
}
if (infoItem.ID == 2)
{
}
if (infoItem.ID == 3)
{
}
}
我只会这种方式添加,而且这种gpBox.Content = txb的方式使得GroupBox只能加载一个textblock,而且很不方便[/quote]
多了解些 布局控件,比如StackPanel。 你在group里增加一个StackPanel, 使用StackPanel.Children.Add 方式增加多个[/quote]
ok,谢谢foreach (AppealInfoDetailItem infoItem in appealInfoDetails)
{
if (infoItem.ID == 1)
{
GroupBox gpBox=new GroupBox();
TextBlock txb = new TextBlock();
txb.Text = infoItem.ID.ToString();
gpBox.Content = txb;
}
if (infoItem.ID == 2)
{
}
if (infoItem.ID == 3)
{
}
}
我只会这种方式添加,而且这种gpBox.Content = txb的方式使得GroupBox只能加载一个textblock,而且很不方便[/quote]
多了解些 布局控件,比如StackPanel。 你在group里增加一个StackPanel, 使用StackPanel.Children.Add 方式增加多个foreach (AppealInfoDetailItem infoItem in appealInfoDetails)
{
if (infoItem.ID == 1)
{
GroupBox gpBox=new GroupBox();
TextBlock txb = new TextBlock();
txb.Text = infoItem.ID.ToString();
gpBox.Content = txb;
}
if (infoItem.ID == 2)
{
}
if (infoItem.ID == 3)
{
}
}
我只会这种方式添加,而且这种gpBox.Content = txb的方式使得GroupBox只能加载一个textblock,而且很不方便