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

Place Combobox in Datagrid

3 Answers 59 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
JungTae
Top achievements
Rank 1
JungTae asked on 27 Oct 2010, 08:56 PM
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>

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 28 Oct 2010, 03:07 PM
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
0
JungTae
Top achievements
Rank 1
answered on 28 Oct 2010, 03:57 PM
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();
            }
      
  
        }
0
George
Telerik team
answered on 03 Nov 2010, 09:16 AM
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
Tags
ComboBox
Asked by
JungTae
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
JungTae
Top achievements
Rank 1
George
Telerik team
Share this question
or