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

Occurrence.Appointment doesn't work

1 Answer 72 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Lucas
Top achievements
Rank 1
Veteran
Lucas asked on 25 Aug 2020, 06:28 PM

Hello,

I'm using this article to make a custom appointment and custom appointment dialog, but it doesn't work. It says that you're supposed to be able to access custom appointment properties, but I try to display a custom appointment property in a combobox and it doesn't work. 

This is my code, my custom appointment has a property named "FactionDef" of type "List_ShiftDTO", I bind it to selectedItem but it can't find it even if it's clearly there. The combobox shows the itemsource and all the "List_ShiftDTO" objects inside the ObservableCollection "TypeFactions".

<telerik:RadComboBox Grid.Row="2" Grid.Column="1"
SelectedItem="{Binding Occurrence.Appointment.FactionDef, Mode=TwoWay}" Margin="3"
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=telerik:SchedulerWindow}, Path=ScheduleView.DataContext.TypeFactions}" DisplayMemberPath="Display"/>

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 28 Aug 2020, 10:40 AM

Hello Lucas,

Thank you for the provided code snippet.

When binding the RadComboBox to a reference type, which I assume the List_ShiftDTO is, you need to ensure that the instance of the value bound to the SelectedItem property is the same as one of the items from the provided ItemsSource. I've set up a small sample project to demonstrate this in action.

Alternatively, you can use the SelectedValue and SelectedValuePath properties, if you have a unique identifier for each item.

Please let me know if any of these two approaches solves your issue. 

Regards,
Dilyan Traykov
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Tags
ScheduleView
Asked by
Lucas
Top achievements
Rank 1
Veteran
Answers by
Dilyan Traykov
Telerik team
Share this question
or