Hi all, I've got myself stuck on a problem in CSLA for Silverlight that I can't seem to get my head around.
I'm implementing the concept of two list boxes, the first containing items that have been selected, the second containing items that are available for selection. The contents of each are mutually exclusive.
There are Add and Remove buttons to move listitems between the two boxes, along with a Save and Cancel button. (See attached screen shot).
The two list boxes use a CSLA data provider to source the data. This works okay to load the initial values as you can see from the screen shot.
Clicking on Add executes the following code:
private void AddButton_Click(object sender, RoutedEventArgs e) { var srce = availColourData.Data as Business.ProductColourList; var dest = usedColourData.Data as Business.ProductColourList; int index = AvailColorListBox.SelectedIndex; if (index >= 0) { var item = srce[index];srce.Remove(item);
dest.Add(item);
}}
.and that moves the selected item across to the other list box.
When I click on Save I want to save the items that are in the 'selected items' list box.
This is where my problem is, I can't work out how to do this.
My colour list business objects are defined as follows:
public
partial class ProductColourList : BusinessListBase<ProductColourList, ProductColour>public
partial class ProductColour : BusinessBase<ProductColour>Ideally I want to save all the 'selected items' in one go, not make a call through the layers each time.
Currently I'm getting an Update method not implemented error because I don't know where to implement my update method, having got all confused about how I should be doing this.
I've looked in the samples and I can't find anything similar. Has anyone implemented anything like this?
Cheers,
Gareth.
Copyright (c) Marimer LLC