0

Using a Listbox, how to have checkboxes for each item that can be added/removed by code , not xaml.

the Simplest example is welcome.

4

1 回答 1

0

除了复选框,尝试在堆栈面板中添加一些控件。我希望这个能帮上忙

将 StackPanel 添加到网格(称为 InputList):

   for(int i = 0; i < 5;i++)
  {

    var checkbox = new CheckBox
    {
      Content = "inbox",

      HorizontalAlignment = HorizontalAlignment.Left,

      VerticalAlignment = VerticalAlignment.Top,

      FontFamily = new FontFamily("Calibri"),

      FontSize = 30
    };

    InputList.Children.Add(checkbox);

  }
于 2012-06-18T12:03:31.680 回答