Custom appointment with collection field (Radcombobox)

6 posts, 1 answers
  1. Filipe
    Filipe avatar
    16 posts
    Member since:
    Jun 2011

    Posted 15 May 2012 Link to this post

    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

     

     

     

  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 15 May 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Filipe
    Filipe avatar
    16 posts
    Member since:
    Jun 2011

    Posted 15 May 2012 Link to this post

    Ok, that worked!

    Thanks
    Filipe
  5. mike okon
    mike okon avatar
    40 posts
    Member since:
    Dec 2009

    Posted 16 May 2013 Link to this post

    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}"/>
  6. mike okon
    mike okon avatar
    40 posts
    Member since:
    Dec 2009

    Posted 17 May 2013 Link to this post

    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

  7. mike okon
    mike okon avatar
    40 posts
    Member since:
    Dec 2009

    Posted 17 May 2013 Link to this post

    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

     


Back to Top
DevCraft banner