Order values in dictionary of UiElements

So I have a dictionary<uielement, uielement>
The first element is: product name
The second element is: product price

I need to have the full uielements in the dictionary because I need to be able to access certain attributes throughout my workflow, like row numbers n stuff.

I want to order my dictionary by price from greatest to least.

I am traversing my dictionary in a for each loop.

I’m trying to use a LINQ to get it ordered like so…(I am a beginner in LINQ, don’t hate!)

   dictionary.Values.OrderBy(Function (x) x.Get("value"))

But I don’t see a way to specifically say order from greatest to least.

I’m also traversing through the Uielements in the dictionary using a for each activity.

So how do I order my values from greatest to least using LINQ on a dictionary in a for each activity?

Use OrderByDescending function for reverse sort.

2 Likes

This solves so many of my problems. Thank you so much.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.