Search code examples
c#wpfitemtemplate

Using * sizing in a data template WPF


I am trying to set a * height property in an item template but I keep getting the error

'50*' string cannot be converted to Length.

Im not sure if what Im wanting to do is possible.

Please let me know if you need anymore information.

Heres my Xaml:

<ItemsControl Name="lstMain" ItemsSource="{Binding Sections}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <GroupBox Header="{Binding Section.SectionName}" Height="50*">
                            <StackPanel>
                                <ItemsControl ItemsSource="{Binding SubSections}" ItemTemplate="{StaticResource BinderTemplate}" />
                            </StackPanel>
                        </GroupBox>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

Solution

  • the point is that Height is a Double data type and not a GridLength, such as grid rows and columns are.

    Only GridLength supports the star size.