Changing data context of RadCombobox

6 posts, 0 answers
  1. Dheenadhayalan
    Dheenadhayalan avatar
    6 posts
    Member since:
    Mar 2011

    Posted 18 Jul 2011 Link to this post

    Hello,

    I have been using the Scheduleview for my project. I modified the style of appointmentdialog through EditAppointmentDialogStyle, by changing the subject text block to radcombobox. I wanted to have list of string to be displayed in the combobox so that user can select the subject from the list. But the problem is I am unable to bind the list to the RadCombobox. It is always returning me Binding error. How can i solve this problem?

    Thanks in advance,
    Dheena
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 Jul 2011 Link to this post

    Hi Dheena,

    Please check this help article - it explains how to bind RadComboBox placed in custom EditAppointmentDialog.

    All the best,
    Yana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Stephen Tearle
    Stephen Tearle avatar
    9 posts
    Member since:
    Feb 2004

    Posted 26 Jun 2012 Link to this post

    Hi

    I have the same problem with not being able to bind a collection to the ItemsSource of a RadComboBox placed inside a custom EditRecurrenceDialog.

    I am using MVVM with PRISM.  I have a UserControl called MyView and it's DataContext is MyViewModel.  The DataContext is set in the code behind.  MyView contains the RadScheduleView control, and MyViewModel contains a collection I want to bind to the RadComboBox.

    In the linked example in the previous post the ViewModel was set in XAML like this:

    <UserControl.Resources>
        <my:MyViewModel x:Key="MyViewModel" />
        ...
    </UserControl.Resources>

    And the RadComboBox binding like this:

    <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource MyViewModel}, Path=ComboBoxItems, Mode=TwoWay}" />


    In my case the ViewModel is the DataContext of the View, and is not set as a resource in XAML.  How can I bind my collection to the RadComboBox?

    Regards
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 29 Jun 2012 Link to this post

    Hi Stephen,

    I am afraid that the only way to bind ItemsSource property to a property in the main ViewModel is setting the ViewModel as a static resource. Since the EditAppointmentDialog is opened in a popup, you will not be able to use a different binding as ElementName, RelativeSource, etc.

    I would suggest is to bind the ComboBox ItemsSource to a property in your custom appointment instead. More information how to create a custom appointment can be found here.

    Regards,
    Yana
    the Telerik team

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

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

    Posted 16 May 2013 Link to this post

    Hi

    I have read through the custom Appointment documentation but have an issue when trying to change the source in the viewmodel of the observable collection to a DB Table

    the documentation only shows how to create a list

    ComboBoxItems = new ObservableCollection<string>() {
                "item1", "item2", "item3"
            };

    When I change this to

    ComboBoxItems = new ObservableCollection<Appointments>();

    no data is returned, However the appointments appear in the schedule view. I tried to dump the data into a grid view and what does appear are  the Column Headings (ie TimeZone, Resources, etc) This leads me to think somethings a miss??

    Can you please provide an example of a RadCombo or rad listbox in a edit appointment dialog which and read data from a table and not just a static list

    regards
    mike

  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 20 May 2013 Link to this post

    Hi Mike,

    Please check our reply at the other thread here.

    I would kindly ask you not to post the same question in different threads as this slows down our reply.
    Thank you for the understanding.

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready