Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to make a ListView GroupHeaderTemplate wrap it's content in iOS?

$
0
0

I've got the following GroupHeaderTemplate. Unfortunately, the inner StackLayout isn't behaving as I'd hope... what might I be doing wrong?

FYI: It appears to work proper in Android.

<ListView
    x:Name="ModuleList"
    ItemsSource="{Binding NavigationSections}"
    IsGroupingEnabled="True"
    GroupDisplayBinding="SectionName"
    HasUnevenRows="True">
  <ListView.GroupHeaderTemplate>
    <DataTemplate>
      <ViewCell>
        <ViewCell.View >
          <StackLayout Orientation="Vertical" BackgroundColor="Teal" Padding="10" HeightRequest="60" >
            <Label Text="{Binding SectionName, Converter={StaticResource UppercaseValueConverter}}"
                   TextColor="White" />
          </StackLayout>
        </ViewCell.View>
      </ViewCell>
    </DataTemplate>
  </ListView.GroupHeaderTemplate>
  <ListView.ItemTemplate>
    <DataTemplate>
      <ViewCell>
        <ViewCell.View>
          <StackLayout Orientation="Horizontal" Padding="10" BackgroundColor="White">
            <Label Text="{Binding Title}" />
          </StackLayout>
        </ViewCell.View>
      </ViewCell>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

Viewing all articles
Browse latest Browse all 58056

Trending Articles