I need a way to determine if an item has already been loaded into a VQCV. I have tried using Contains but it always returns false. I have also tried the following which returns a "source is not IEnumerable" error:
if (candidate.StateID.HasValue && m_States.AsQueryable().OfType<State>().Where(s => s.StateID == candidate.StateID.Value).Count() < 1)
SharedContext.Context.Load(SharedContext.Context.GetStateByIDQuery(candidate.StateID.Value), OnStatesLoaded, true);
isStateLoaded = true;
Is there a way to determine if an item is already in a VQCV without resorting to a ForEach loop?
The scenario I'm trying to solve is this. The user navigates to a grid, selects a row and clicks an Edit button. The Edit button launches a child window containing several RadComboBoxes backed by a VQCV. I need to determine if an item as been loaded in the VQCV so that the item shows up in the RadComboBox for the user to see. For example, one of the RadComboBoxes contains States. If this is the first time the user has opened the edit child window, the states will not be loaded yet. Therefore I must load the state so that the user will see "Alabama" in the RadComboBox.
If there is a better technique than manually searching for the state and then loading it if needed please let me know.
Update: I see from this thread that I'm not the only one fighting this battle: http://www.telerik.com/community/forums/silverlight/data-virtualization/initialize-value-for-the-radcombobox-with-load-in-demand-feature.aspx
I guess it's time to look for alternative solutions.