dimanche 31 mai 2015

Adding checkBoxes to UniformGrid

I am adding dynamically created checkboxes to an uniformgrid in wpf. But it looks like the gird doesnt allocate them enough space and so they all kinda lay over each other. This is how I add them in code behind:

foreach (string folder in subfolders)
{
  PathCheckBox chk = new PathCheckBox();
  chk.Content = new DirectoryInfo(folder).Name;
  chk.FullPath = folder;
  chk.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
  chk.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;        

  unfiformGridSubfolders.Children.Add(chk);
}

This is how my XAML looks (I placed the uniformgrid in a scrollviewer)

<ScrollViewer Grid.Column="1" Grid.RowSpan="3">
  <UniformGrid x:Name="unfiformGridSubfolders" Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
</ScrollViewer>  

And this is how it looks in the program:

enter image description here

I just want that every checkBox has enough space, so that the content can be fully read.




Aucun commentaire:

Enregistrer un commentaire