本文整理汇总了C#中ListBox.GetItemContainer方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.GetItemContainer方法的具体用法?C# ListBox.GetItemContainer怎么用?C# ListBox.GetItemContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListBox
的用法示例。
在下文中一共展示了ListBox.GetItemContainer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
public override void LoadContent()
{
base.LoadContent();
smallFont = ContentManager.Load<SpriteFont>(@"Fonts\kootenaySmall");
var grid = new Grid();
grid.Width = Width;
grid.Height = Height;
grid.Rows.Add(Size.Fill());
grid.Rows.Add(Size.Fixed(30));
grid.Rows.Add(Size.Fill(4));
grid.Rows.Add(Size.Fixed(40));
grid.Rows.Add(Size.Fixed(80));
grid.Rows.Add(Size.Fixed(80));
grid.Columns.Add(Size.Fill());
Controls.Add(grid);
grid.Cells[1, 0].Add(new Label { Text = "Select Party Members" });
memberListBox = AddListBox<Actor>(grid.Cells[2,0], Vector2.Zero, 300, 250);
memberListBox.EnableCheckBoxes = true;
grid.Cells[3, 0].Add(new Label { Font = smallFont, Text = Bind(() => {
if (memberListBox.CheckedItems.Any())
{
if (memberListBox.CheckedItems.SelectMany(x => x.Equipment).Any())
{
var averageItemLevel = Math.Round(memberListBox.CheckedItems.SelectMany(x => x.Equipment).Average(x => x.Level));
return "Average item level: " + averageItemLevel.ToString();
}
}
return "";
})
});
var startButton = CreateButton("Start", Vector2.Zero);
startButton.Click += okButton_Click;
grid.Cells[4,0].Add(startButton);
var backButton = CreateButton("Back", Vector2.Zero);
backButton.Click += backButton_Click;
grid.Cells[5, 0].Add(backButton);
memberListBox.Items.AddRange(player.Heroes);
for (int i = 0; i < memberListBox.Items.Count; i++)
{
if (i < encounterDefinition.HeroLimit)
memberListBox.GetItemContainer(memberListBox.Items[i]).Checked = true;
}
}