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

ComboBox in CellEditTemplate

3 Answers 486 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pablo Tola
Top achievements
Rank 2
Pablo Tola asked on 01 Jun 2010, 04:10 AM
Hello,

I'm using the combobox in this example inside a grid as a celledittemplate:

http://www.telerik.com/community/forums/silverlight/combobox/multiselect-option-in-combo-box.aspx

I'm now stuck because I want to bind the comma separated values to the column dataitem, it is a string type.
I'm kind of new to wpf binding and I've tried a lot of things to get this done, but cannot achieve my goal.
please help.

Here's the column definition, Choices is the property I need to bind the results of the checked items.

<telerik:GridViewDataColumn Header="Choices"   
   DataMemberBinding="{Binding Choices, Mode=TwoWay}">  
   <telerik:GridViewDataColumn.CellEditTemplate> 
      <DataTemplate> 
         <telerik:RadComboBox x:Name="ChoicesCombo" 
            Loaded="OnChoicesComboBoxLoaded" SelectedIndex="0"   
            SelectedValue="{Binding Choices, Mode=TwoWay}" > 
            <telerik:RadComboBox.ItemTemplate> 
               <DataTemplate> 
                  <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}"   
                     Content="{Binding Text}" /> 
               </DataTemplate> 
            </telerik:RadComboBox.ItemTemplate> 
            <telerik:RadComboBox.SelectionBoxTemplate> 
               <DataTemplate> 
                  <TextBlock Text="{Binding Owner.CheckedItems, Converter={StaticResource ValueConverter}}" /> 
               </DataTemplate> 
            </telerik:RadComboBox.SelectionBoxTemplate> 
         </telerik:RadComboBox> 
      </DataTemplate> 
   </telerik:GridViewDataColumn.CellEditTemplate> 
</telerik:GridViewDataColumn> 

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 02 Jun 2010, 02:43 PM
Hi Pablo Tola,

Please use the attached sample as a starting point.

Regards,
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
Pablo Tola
Top achievements
Rank 2
answered on 03 Jun 2010, 03:24 PM
Thanks for the sample, I ended up creating a user control and exposing two dependency properties, ItemsSource and SelectedItems, that way I can reuse it anywhere I want to.

Thanks again.
0
Chango
Top achievements
Rank 1
answered on 16 Sep 2013, 03:11 PM
please can up this example on mvvm pattern?
Tags
GridView
Asked by
Pablo Tola
Top achievements
Rank 2
Answers by
Pavel Pavlov
Telerik team
Pablo Tola
Top achievements
Rank 2
Chango
Top achievements
Rank 1
Share this question
or