Binding a ComboBox to an enum nested in a class

Another way of getting the enum values for use as a data source: <Window.Resources> <ObjectDataProvider MethodName=”GetValues” ObjectType=”{x:Type sys:Enum}” x:Key=”TestValues”> <ObjectDataProvider.MethodParameters> <w:Type2 TypeName=”w:Test+TestEnum” /> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> </Window.Resources> … ItemsSource=”{Binding Source={StaticResource TestValues}}” Note that you still need the Type2Extension because of weirdness with TypeExtension and nested types. But you wouldn’t need the extra custom markup extension. This … Read more

Retrieving values from nested JSON Object

Maybe you’re not using the latest version of a JSON for Java Library. json-simple has not been updated for a long time, while JSON-Java was updated 2 month ago. JSON-Java can be found on GitHub, here is the link to its repo: https://github.com/douglascrockford/JSON-java After switching the library, you can refer to my sample code down … Read more

Sort nested array of objects

I would store it in the order you want it back out. Or sort it after you pull it out, on the client side. If neither of those are possible, you can use the aggregation framework: > db.test.insert({answers: [ … {name: ‘paul’, state: ‘RU’}, … {name: ‘steve’, state: ‘US’}, … {name: ‘mike’, state: ‘DE’}]}); > … Read more