I have xaml custom listbox item, which height is 165px
I'm fillin StackPanel with those items:
StackPanel list = new StackPanel();
foreach (Course course in Semestris.Courses)
{
TI.Course.Text = course.Name;
list.Children.Add(TI);
}
Color color = ConvertStringToColor("#FF838383");
Brush brush = new SolidColorBrush(color);
list.Background = brush;
list.Height = list.Children.Count*165; //make size of stack panel just as to display all elements
And add color to find a bug.
This stack panel is being placed inside Expander StackPanel:
Expander.Expander a = new Expander.Expander();
a.IsExpanded = false;
a.Content = list;
a.HeaderContent = Semestris.Name;
Expander control has every row set to auto which means it will aply sizes of children.
And the last step to place all Expander into 1 stack:
Stack.Children.Add(a);
And my problem is that:
All colapsed expanders work fine:
When items are not many, all works fine:
But when items count is over 30 items it does this:
Where is the problem?