IsLastItemConverter / IsNotLastItemConverter #1339
Closed
ewerspej
started this conversation in
New Feature Discussions
Replies: 1 comment 3 replies
-
I don't think this is possible, because |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to propose to add an
IsLastItemConverter
as well as anIsNotLastItemConverter
to the list of converters to determine whether or not an element is the last item in anIEnumerable
and then update the view accordingly.The implementation could be as simple as:
One major use case would be to allow users to make decisions in their XAML based on whether an item is the last element in an
ItemsSource
, for example to show a divider or use a different color value, etc:I can provide a PR with this myself, if this is something that is deemed useful.
Notes:
IValueConverter
interface doesn't allow to specify a generic type argument. Alternatively, I would need to useIEnumerable
without the type and iterate through the enumerable until I hit the last item and compare that to thevalue
argument.Beta Was this translation helpful? Give feedback.
All reactions