This is a migrated thread and some comments may be shown as answers.

RadListBox Losing selected items on month change

2 Answers 43 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 14 Dec 2012, 07:03 PM

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

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 19 Dec 2012, 02:11 PM
Hi Tim,

We tried to reproduce the issue but with no success.

Could you try to recreate the issue in a sample project and send it to us so we can observe the issue at our side and see what could be the cause of it?

Kind regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Tim
Top achievements
Rank 1
answered on 19 Dec 2012, 02:36 PM
The issue was in the code. The RadListBox was rebuilding everytime regardless if the RadComboBox was changed.

It is now working.

Tim
Tags
ScheduleView
Asked by
Tim
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Tim
Top achievements
Rank 1
Share this question
or