locked
Struggle With Implementing Complex Tree View with Multiple Table Relationships RRS feed

  • General discussion

  • Hey all,

    I recently began Visual Studio 2012 (LightSwitch in C#) about a month and a half ago so I apologize in advance if any terminology I use ends up confusing you as I have a merely decent feel about the IDE, and  terminology used.

    My employer asked me to implement a simple tree-view Silverlight tool in LightSwitch, and I read Michael Washington's important article, "Tree Control: Hierarchical Data with LightSwitch".

    I followed everything and it worked out and all was good.

    However, the problem comes after this. I began to think a step ahead of how this could be applied to several big projects with multiple tables with multiple relationships, unlike the example in the aforementioned post where the data is all contained in one table which is self-referencing.

    As a result, I came up with this example: There are 3 tables- Type, Food, and Ingredients. Ingredients belong to a Food and a Food belongs to a Type. For example a Type in this example is considered to be Breakfast, Lunch, or Dinner, and a Sandwich is an example of a food instance, with Salad, Mayo, and Ham as its respective Ingredients. As it can be seen, there is a hierarchy present (for the Breakfast type we have A Salad food and Mayo, Ham, and Salad Ingredients) so I was trying to implement a tree view where my Type is the root and that will be Breakfast, Lunch, and Dinner, and after I dropdown on any of those 3 options I can see the respective Foods that I added under Breakfast, Lunch or Dinner and for each food I can see its respective ingredients.

    I tried modifying and playing with the Xaml to try and see results, also played around with the EntityCollectionValueConverter class code from Michael Washington's post and so many different things. After a lot of research I didn't end up far and thought I could use some help on this.

    Thank you in advance and looking forward to understanding how to get around this!


    Monday, November 14, 2016 2:28 PM