Monday, January 21, 2013

Using a custom edit screen in Lightswitch 2012 instead of the default modal dialog window

When you add a new Details Screen and check the ‘Use as default Details screen’, it will be used as edit screen by the Search Data screen, but not by the Editable grid screen.

In the Editable grid screen you need to write code behind the Edit button to open the Edit Details screen.

However instead of explicitly opening the Edit Details Screen by name, you can use the entities default screen property.

Instead of writing

partial void gridEditSelected_Execute()
{

Application.ShowCreateNewCustomerEdit(this.Customers.SelectedItem.Id);
}

Write this


partial void gridEditSelected_Execute()
{


this.Application.ShowDefaultScreen(this.Articles.SelectedItem);
}


This tip came from Justin Anderson on one of the Lightswitch msdn fora.

No comments: