I have a RadListBox that gets populated from the value in a RadComboBox. The RadListBox is below:
<
telerik:RadListBox
Name
=
"myList"
Width
=
"200"
Height
=
"200"
ItemsSource
=
"{Binding ResourceItemList}"
>
<
telerik:RadListBox.ItemTemplate
>
<
DataTemplate
x:Name
=
"myTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
CheckBox
ClickMode
=
"Press"
IsChecked
=
"{Binding IsSelected, Mode=TwoWay}"
telerik:StyleManager.Theme
=
"Office_Silver"
>
<
CheckBox.Content
>
<
TextBlock
Text
=
"{Binding Name}"
></
TextBlock
>
</
CheckBox.Content
>
</
CheckBox
>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadListBox.ItemTemplate
>
</
telerik:RadListBox
>
Whenever I click to the next or previous month, the selected items in the RadListBox are unchecked. This is because of the MainPageViewModel code below. The RadListBox is populated from this.workerGetServiceAppointments.DoWork shown below:
public MainPageViewModel(ILifestyleLiftServiceAgent serviceAgent)
{
this.ResourceItemList = new ObservableCollection<
ResourceItem
>();
if (!IsDesignTime)
{
if (serviceAgent != null) ServiceAgent = serviceAgent;
SetNonWorkingHours();
this.workerGetServiceAppointments.DoWork += new DoWorkEventHandler(workerGetServiceAppointments_DoWork);
this.workerGetServiceAppointments.RunWorkerCompleted += new RunWorkerCompletedEventHandler(workerGetServiceAppointments_RunWorkerCompleted);
ServiceAgent.GetSites(Centers);
}
}
And here's the DoWork code:
void workerGetServiceAppointments_DoWork(object sender, DoWorkEventArgs e)
{
ServiceAgent.GetResources(SelectedSiteId, ResourceItemList, UpdateResourceTypes);
}
The GetResources call works and the RadListBox is re-populated. How can I keep the selected items in the ResourceItemList from resetting when I change the month or view from Day/Week/Month and only change it when the RadComboBox is modified?
Tim