I know by editing the ListBox
's default style like this, I can have a Button
at the very end of the ListBox
.
<ScrollViewer x:Name="ScrollViewer" ...>
<StackPanel>
<ItemsPresenter />
<Button />
</StackPanel>
</ScrollViewer>
However, doing this will break the ListBox
's Virtualization and the rendering time becomes really long.
All I can think of is,
- Create a dummy item and add it to the end of my item collection in
the viewmodel, and have a
Visibility
property in the dummy object called ButtonGridVisibility and set it to Visibility.Visible
.
- In my
ListBox
's ItemTemplate
, have two Grids
. One displays
the normal item layout, the other displays the Load More Button
.
Then toggle their Visibility
based on ButtonGridVisibility property.
This might work but I just wonder if there is any easier/better way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…