How to keep LongListSelector's current group name on top
-
24-06-2021 - |
Question
I'm sure it has been asked before, but i cant find the answer. Is it possible using the LongListSelector control to always show the name of the current group? Just like it works in the People hub.
Solution
This is just a snippet. Please modify it as necessary.
var transform = llstItems.TransformToVisual(Application.Current.RootVisual);
Point pointTarget = transform.Transform(new Point(0, 0));
pointTarget.X += 5;
pointTarget.Y += 6;
List<UIElement> elements = (List<UIElement>)VisualTreeHelper.FindElementsInHostCoordinates(pointTarget, Application.Current.RootVisual);
if (elements != null && elements.Count > 0)
{
TextBlock textGroupedHeader = elements[0] as TextBlock;
if (textGroupedHeader != null)
{
Main.GroupTitle = textGroupedHeader.Text;
}
}
OTHER TIPS
You can get the control as part of the Windows Phone Toolkit
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow