Multiselection of grid items
The main idea is easy:
- DataGrid Layout Item must have 'AllowMultiselect' property or something like this;
- ScreenObject must provide 'SelectedItems' property to get access to collection of selected item from code.
By the way, here is my temporary solution to solve this problem:
public partial class SearchCustomers
private DataGrid grid;
partial void SearchCustomers_Created()
// Write your code here.
var dgControl = this.FindControl("grid");
dgControl.ControlAvailable += new EventHandler<ControlAvailableEventArgs>(dgControl_ControlAvailable);
void dgControl_ControlAvailable(object sender, ControlAvailableEventArgs e)
grid = e.Control as DataGrid;
if (grid != null)
grid.SelectionMode = DataGridSelectionMode.Extended;
grid.SelectionChanged += new SelectionChangedEventHandler(grid_SelectionChanged);
void grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
this.SelectedCount = grid.SelectedItems.Count;
You need to override <Screen>_Created() method to get DataGrid object and then access to it for you needs. Don't forget that you must also override Delete method to delete all selected items in grid not just first selected.
Thank you for your suggestion on improving LightSwitch. However, Visual Studio 2015 is the last release of Visual Studio that includes the LightSwitch tooling and we recommend users not begin new application development with LightSwitch. That said, we will continue to support users with existing LightSwitch applications, including critical bug fixes and security issues as per the Microsoft Support Lifecycle. Please see the blog post for more information: https://blogs.msdn.microsoft.com/lightswitch/2016/10/14/lightswitch-update/
– The Visual Studio Team
this feature is highly required for business app in practice.