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

Set Checked Resource Items in Code Behind

4 Answers 101 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 30 Aug 2012, 02:02 PM
Hi,
I try to attach some default values to certain categories, i.e. when the user selects "Category1" in the CategoryCombo, the "Subject", "Body" etc. in the current appointment should be filled with a default text/values.

Now to my problem:
As soon as a category entry is selected, I'd like to "preselect" the default resources in the drop down "Personen" (see screenshot attached).

I've attached an event handler "PART_Categories_SelectionChanged "to the CategoryCombo. Is there a way to access the checkedItems in the resources drop down in order to set the default selection from code behind?

Thank you four your help!

Regards
Daniel

4 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 04 Sep 2012, 10:08 AM
Hi Daniel,

You shouldn't have any issue when attaching events to the control in the EditAppointmentDialog. All that is needed is to customize the EditAppointmentDialogStyle and add the needed event to the RadComboBox with x:Name="PART_Categories", and in the event handler cast the sender object as RadComboBox in order to get the SelectedItem.

I created and attached a sample project for you to take a look at. Give it a try.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Daniel
Top achievements
Rank 1
answered on 04 Sep 2012, 02:46 PM
Hi Vladi,

thank you for your help.
Obviously, I was not clear enough with my question. What I'd like to achieve is to "preselect" some items not in the category dropdown but in the resources dropdown labeled "Personen" (sorry for that "messy" screen shot...). 
 That is, as soon as the pinkish category "... Singen"  is picked, the resources "Gabriel..", "Stefan..." and "Thomas..." in the "Personen" dropdown should be selected.
The items in this drop down are bound via ResourceTypesSource to the "standard" EF tables ResourceType and Resource, respectively.

Hope, this clarifies my question.

Regards,
Daniel
0
Accepted
Vladi
Telerik team
answered on 05 Sep 2012, 02:02 PM
Hello Daniel,

In that scenario first you will need to:
  1. Cast the DataContext of the ComboBox as AppointmentDialogViewModel in the SelectionChanged event.
  2. Find the ResourceType that you want to preselect and cast it as ResourceTypeViewModel.
  3. Finally change the SelectedItem of that ResourceType to the Item that you want to be preselected.

We edited and attached the sample project for you.

Hope this helps.

All the best,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Daniel
Top achievements
Rank 1
answered on 06 Sep 2012, 03:26 PM
Hello Vladi,

thank you for your examples. With some slight modifications, I was even able to preselect the resources marked with "AllowMultipleSelection".

Best regards,
Daniel
Tags
ScheduleView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or