Place Combobox in Datagrid

4 posts, 0 answers
  1. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 27 Oct 2010 Link to this post

    I am using RadComboBox which is binded to an observable collection of data. Right now, nothing appears as a default text when the comboboxes are loaded, and I am unable to catch the SelectionChanged event. here is my XAML code and I will be more than glad to provide more code if it is required.

    My company is using Silverlight 3 on VSTS 2008 SP 1

    <telerikDataView:RadGridView.Columns >
                                          <telerikDataView:GridViewDataColumn Header="Params">
                                                                                          <telerikDataView:GridViewDataColumn.CellTemplate >
                                                  <DataTemplate>
                                                                                                         <telerikInput:RadComboBox x:Name="TelerikParamSelection" IsEditable="True" IsReadOnly="False"
                                                                    ItemsSource="{Binding paramNameList,Mode=TwoWay}"                                   
                                                                    DisplayMemberPath="Name" 
                                                                    Loaded="TelerikParamSelection_Loaded">
                                                      </telerikInput:RadComboBox>
                                                  </DataTemplate>
                                              </telerikDataView:GridViewDataColumn.CellTemplate>
                                          </telerikDataView:GridViewDataColumn>
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 28 Oct 2010 Link to this post

    Hi JungTae,

    May I see the implementation of your business objects - the ones used as ItemsSource for RadGridView  and the ones you need to use as items source of the combo . A few words about the expected behavior would be also helpful .

    Now on your code  most probably the problem is in this line :

    ItemsSource="{Binding paramNameList,Mode=TwoWay

    Where is the paramNameList property located ? 

    Once I have more details on your scenario , I will be able to provide you with further assistance.

    All the best,
    Pavel Pavlov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 28 Oct 2010 Link to this post

    paramNameList is an ObservableCollection of objects with properties

    string Name   and Binary JPEG, and I am trying to display the Names in my combobox.
    I got all the data to appear in the dropdown list, and the SelectionChanged event IS being detected now. However, the dropdown menu does not appear automatically when the user is manually typing into the combobox.

    private void TelerikParamSelection_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
            {
                if (e.AddedItems.Count > 0)
                {
                    string name = e.AddedItems[0].ToString();
                    int indexModel = this.PricingModelGrid.Items.IndexOf(this.PricingModelGrid.SelectedItem);
                    int indexParam = this.ModelParametersList.Items.IndexOf(this.ModelParametersList.SelectedItem);
      
                    if (name != null)
                    {
                        EFParameterName paramName = paramList.Where(x => x.Name.Equals(name)).First();
      
                        Models[indexModel].EFParameterNames[indexParam] = paramName;
      
                        paramName.EFPricingModels.Add(Models.ElementAt(indexModel));
                    }
                }    
            }
      
            private void TelerikParamSelection_Loaded(object sender, RoutedEventArgs e)
            {
                Telerik.Windows.Controls.RadComboBox curCombobox = sender as Telerik.Windows.Controls.RadComboBox;
                curCombobox.ItemsSource = paramList;
                curCombobox.SelectedIndex = paramList.IndexOf
                                                (paramList.Where
                                                (x =>
                                                    x.Name == (this.ModelParametersList.SelectedItem as EFParameterName).Name).
                                                    First());
      
                  
                
                this.ModelParametersList.Items.MoveCurrentToNext();
                if (this.ModelParametersList.Items.IndexOf(this.ModelParametersList.SelectedItem) == -1)
                {
                    this.ModelParametersList.Items.MoveCurrentToFirst();
                }
          
      
            }
  5. George
    Admin
    George avatar
    1332 posts

    Posted 03 Nov 2010 Link to this post

    Hi,

    I would suggest you to set the OpenDropDownOnFocus property to True. For more information you could refer to:


    I hope this helps.


    All the best,
    George
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top