Many-to-Many Control Released!

Many-to-Many Control Released!

Rate This
  • Comments 11

A common request that the LightSwitch team receives is to provide a control to deal with many-to-many relationships (ex. the relationship between Categories and Blog Posts).  One of the more common ways to deal with this is by displaying a list of checkboxes or a tree of checkboxes.  We've just released it an extension that provides this functionality.   Here's a quick list of the extension's functionality:

  • Display a list of checkboxes when the control is selected for a many-to-many relationship mapping table
  • If the entity that represents the choices (ex. Category) is self-referential, a tree of checkboxes is instead displayed
  • Developers can customize the query used to provide the set of options displayed in the control

You can download the extension and find instructions on how to use it here:

Many to Many Control for Visual Studio LightSwitch

Leave a Comment
  • Please add 7 and 2 and type the answer here:
  • Post
  • Bad link to 'Many to Many Control for Visual LighSwitch'. :-(

  • I published a walk-thru of the control at:

    lightswitchhelpwebsite.com/.../Using-The-Sheel-Shah-Many-To-Many-Control.aspx

  • thanks this is great. will it be avialble in c#

  • Is there a many-to-many control that uses combo box instead of check boxes?

    Please see my question at social.msdn.microsoft.com/.../a55ca06d-7406-4115-8d4a-855ebc12aef6

    Thanks!

  • @bhuven # -You can use the extension in either VB or C# LightSwitch projects. However the source code is only available is VB.  

  • Control is excellent.

    Reduces programming a lot of code.

    One problem:

    The field shown in the checkbox list is defined as "summary"-field, but it is not really the SUMMARY field of the table (that is defined in "Choices navigation property").

    I found out that it is the first string field in the table.

    But when I place some other field as first string field in the table an error occurs: "Object reference not set to an instance of an object." every time a listbox item is displayed.

  • To Albert Korstanje: I am getting "Object reference not set to an instance of an object." when trying to use calculated property as first string field (reason seems to be that calc property value is evaluated after binding, so value is null when UI tries to access it). But any other string field is fine. Workaround for showing calculated column is defining it in SQL Server table (in db) rather than in app

  • To Peter Durica:

    Thanks for your positive posting.

    I have added a field in the table that replaces the calculated field and it is a pretty good workaround, although it takes extra storage capacity.

    Remains the problem that it is strange that the control does not take the defined "summary" field.

  • Great control thanks!!  However, found a problem when the Summary Property is a calculated property.  It throws an "Object reference not set to an instance of an object" exception in the UpdateText method in  CheckboxList.xaml.vb.  Also, the GetSummaryProperty seems to only pick the first string property instead of picking the defined Summary Property.  So, to reproduce this error you need to make the calculated property the first string property in the entity.

  • I'm having trouble with building my LightSwitch application via TFS2012 Build when I have the Many to Many Control referenced.  I get the following error:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v2.0\Microsoft.LightSwitch.targets (146): The "BuildSchema" task failed unexpectedly.

    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

    The project builds fine locally in VS2012 and I am using my machine as a Build Agent, so I know the machine has everything installed that it needs.

    If I simply remove the Many to Many control reference, the TFS Build Agent can build the project fine.

  • I'm having trouble with building my LightSwitch application via TFS2012 Build when I have the Many to Many Control referenced.  I get the following error:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v2.0\Microsoft.LightSwitch.targets (146): The "BuildSchema" task failed unexpectedly.

    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

    The project builds fine locally in VS2012 and I am using my machine as a Build Agent, so I know the machine has everything installed that it needs.

    If I simply remove the Many to Many control reference, the TFS Build Agent can build the project fine.

Page 1 of 1 (11 items)