Using a Listbox, how to have checkboxes for each item that can be added/removed by code , not xaml.
the Simplest example is welcome.
Using a Listbox, how to have checkboxes for each item that can be added/removed by code , not xaml.
the Simplest example is welcome.
除了复选框,尝试在堆栈面板中添加一些控件。我希望这个能帮上忙
将 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);
}