I am sry for the Titel but I dont know how to describe the Problem in one sentence. So my Problem is a Design Problem in c# / xaml. My Program read out data from a txt-File and creates out of that data Checkboxes inside a Canvas. The Problem is that the CheckBoxes get listet among themselves and continue that over the border of the Canvas instead of listing the new ones in a new Column. So my Question is: How do I list them without that they getting over the Border of the Canvas?
dg_Rohdaten.SetBinding(ItemsControl.ItemsSourceProperty, new Binding { Source = dtbl_erste_Zeile });
double offset = 0;
//Checkboxen und Labels erzeugen
for (int i = startindex; i < dtbl_erste_Zeile.Columns.Count - 1; i = i + wiederholung)
{
if (i / wiederholung > anzahl)
{ break; }
Merkmalsliste.Add(Convert.ToString(dtbl_erste_Zeile.Rows[0][i]));
cb_activated_Measurements.Add(new CheckBox());
Checkers.Children.Add(cb_activated_Measurements[cb_activated_Measurements.Count - 1]);
Canvas.SetTop(cb_activated_Measurements[cb_activated_Measurements.Count - 1], offset);
activated_Measurements_label.Add(new Label());
Checkers.Children.Add(activated_Measurements_label[activated_Measurements_label.Count - 1]);
Canvas.SetTop(activated_Measurements_label[activated_Measurements_label.Count - 1], offset - 5);
Canvas.SetLeft(activated_Measurements_label[activated_Measurements_label.Count - 1], 20)
activated_Measurements_label[activated_Measurements_label.Count - 1].Content = Convert.ToString(dtbl_erste_Zeile.Rows[0][i]);
offset = offset + 20;
}
The Code above is the Code to create the CheckBoxes inside the Canvas names "Checkers". I hope you understand my question and can help me with my Problem :)
Aucun commentaire:
Enregistrer un commentaire