How to create a AddandEditNew ModalWindow step-by-step ? RRS feed

  • Question

  • Hi, I'm very new to Lightswitch developping and I can understand code logic on an intermediate level, but it's my first time with C# too so I'm having a few issues creating a good looking Many-to-Many DataGrid element on my screens.

    I've been looking for ways to create my own AddandEdit window and as of now I found two great forum posts on how to achieve this. However, both show what code to add but I do not understand where that coding has to be done.

    Here are the posts:

    (This one explains the code behind the custom ModalWindow class that has to be made, but then I don't know how to implement it)

    (This one seems to show an example of an instance of said class, also without the steps behind it)


    So if anyone could please guide me through this process I would greatly appreciate; this is for a job that I must do and I'm pretty stuck without this feature.

    Thanks in advance!
    • Edited by Oppiie Wednesday, September 30, 2015 8:48 PM
    Wednesday, September 30, 2015 8:48 PM

All replies

  • Hi,

    From your description above, it's recommended to refer to Beth's video, you will see how you can use the Screen Designer to modify a default Edit Details screen to also allow adding new records. You will also see how to write code to enable and disable buttons depending on the edit or add mode of the screen.

    See: Create a Screen that can Both Edit and Add Records in a LightSwitch Application?

    With regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 7, 2015 9:20 AM
  • Hello Angie,

    Thank you for answering me, however what that video explains is not quite what I'm looking for. I do know how to create such screens that are for editing and creating records/details. What I must do is find a way to make a fully functionnal custom Modal Window for the AddandEdit default button of a data grid.

    Here is what I was able to achieve so far, but as you can see, my custom control (the combobox) doesnt seem to work properly; it does show that I have 3 records to choose from in the source table, however it only displays tiny blanks in the dropdown list. When I pick one of the blanks and select EDIT, it shows me the right details of the selectedItem.


    So in short, I'd like to know how to make that modalwindow actually Add a record with custom controls to enter said record's info, and also what could be the problem with my custom combobox.

    Here's the control's xaml if that can help:


    Thank you

    EDIT: I just noticed that the DisplayMemberPath was wrong, now my ComboBox works perfectly !

    • Edited by Oppiie Wednesday, October 7, 2015 8:49 PM Fixed 1 of 2 issues
    Wednesday, October 7, 2015 8:13 PM