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

Custom appointment with collection field (Radcombobox)

5 Answers 96 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Filipe
Top achievements
Rank 1
Filipe asked on 15 May 2012, 02:30 PM
Hello.

I have been trying your radschedulerview for silverlight for the past few days. I almost have everything to work except for a radcombobox that i added to the edit appointmentment template. the code is the following:

<telerik:RadComboBox x:Name="Activity" Margin="3" Width="210" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Left"
IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}"
ItemsSource="{Binding Source={StaticResource ViewModel}, Path=ActivitiesCollection, Mode=TwoWay}" SelectedItem="{Binding Occurrence.Appointment.Activity, Mode=TwoWay}" 
DisplayMemberPath="Name"
ClearSelectionButtonVisibility="Visible"                                          ClearSelectionButtonContent="{Binding ClearSelectionButtonContent}"
SelectionBoxTemplate="{StaticResource ActivityComboBoxItemContentTemplate}"
telerik:StyleManager.Theme="{StaticResource Theme}" />


So, I created the Activity field in the custom appointment, and the activitiescollection in the viewmodel. The collection works ok, but when i bring the appointments from the database (first time it loads), the combobox doesn't have the value i selected earlier. I checked in the code and the Activity field of the custom appointment is not null and it has the values I inserted.
So what is the problem?

Thanks

Filipe

 

 

 

5 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 15 May 2012, 03:05 PM
Hello Filipe,

Please try to override Equals method of the Activity class ( the class that is used for RadComboBox items ). I guess that this is the reason why the selected item is not recognized in the collection.

Let us know the result.

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Filipe
Top achievements
Rank 1
answered on 15 May 2012, 07:10 PM
Ok, that worked!

Thanks
Filipe
0
mike okon
Top achievements
Rank 1
answered on 16 May 2013, 11:58 AM
Hi I have something Similar however I require the RadComboBox To show one thing but its value to be another.

I have created a UserId Field in the SQLAppointments table which holds a Guid

I have plugged in the RadComboBox to a view and brings back  the Guid and full name.

In the edit appointments dialog how can I have the RadComboBox only display the Full Name but when a name is selected have it write the value of the guid back into the DB table .

regards
mike
<telerik:RadComboBox x:Name="User"
                                        Margin="3"  Grid.Column="1" Grid.Row="0"  Grid.ColumnSpan="2"
                                        HorizontalAlignment="Left"
                                        IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}"
                                         
                                        SelectedItem="{Binding Occurrence.Appointment.UserId, Mode=TwoWay}"
                                        DisplayMemberPath="Name"
                                        ClearSelectionButtonVisibility="Visible"                                         
                                        ClearSelectionButtonContent="{Binding ClearSelectionButtonContent}"
                                         
                                        telerik:StyleManager.Theme="{StaticResource Theme}"/>
0
mike okon
Top achievements
Rank 1
answered on 17 May 2013, 03:36 PM
Hi

part one of my problem to bring back data  is solved. I have managed to bring back the specific column by using a template and ItemsSource. 

ItemTemplate="{StaticResource CustomItemTemplate}"

ItemsSource="{Binding Members}" />


However I am not able to do this with my Custom Table. (Not part of the appointments tables. )
in the ScheduleViewViewModel I have added

public ObservableCollection<MembersClubMember> Members

{

get;

private set;

}

this.Members = new ObservableCollection<Web.MembersClubMember>();


Is their something missing or does the EditAppointmentDialog Popup window not load the table data for some other reason.

regards
mike

0
mike okon
Top achievements
Rank 1
answered on 17 May 2013, 04:37 PM
Hi

I have managed to get this working but still only half way and only on loading of the scheduleview main view. . By adding the code to the

ScheduleViewViewModel

change above to

public ObservableCollection<ScheduleView_DB_CS.Web.MembersClubMember> Members

{

get;

private set;

}

add to private void LoadData() at the bottom of the page

 

ScheduleViewRepository.Context.Load(ScheduleViewRepository.Context.Get2MembersClubMembersQuery()).Completed += (o, e) =>

{

this.Members.AddRange((o as LoadOperation).Entities);

};

However the Combobox does not populate in the EditAppointmentDialog window as expected

Please can you provide a sample project showing how this can be achieved
mike

 


Tags
ScheduleView
Asked by
Filipe
Top achievements
Rank 1
Answers by
Yana
Telerik team
Filipe
Top achievements
Rank 1
mike okon
Top achievements
Rank 1
Share this question
or