- <controls:FoldableContentControl.FoldableContent>
- <ListView ItemsSource="{x:Bind MyItemList}">
- <ListView.ItemTemplate>
- <DataTemplate>
- <StackPanel BorderBrush="LightGray"
- BorderThickness="0.5">
- <TextBlock Text="{Binding}"
- HorizontalAlignment="Center"
- Padding="10"/>
- </StackPanel>
- </DataTemplate>
- </ListView.ItemTemplate>
- <ListView.ItemContainerStyle>
- <Style TargetType="ListViewItem">
- <Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="Padding" Value="0"/>
- </Style>
- </ListView.ItemContainerStyle>
- </ListView>
- </controls:FoldableContentControl.FoldableContent>
You can specify the content in the header from changing the ‘HeaderText’ property.
You can specify the content, which you want to display, when there are no items in the content. Simply, add a framework element to the ‘EmptyContent’ property or change the ‘EmptyText’ property. To display this emptiness, you have to set the ‘DisplayEmpty’ property to true. (If a ItemsControl simply binds the ‘Count’ property with a value converter).
You can find the source code in my GitHub repo.
Join the conversation! Your thoughts help the community grow.