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

[Solved] Binding combo inside GridView

1 Answer 139 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Devika
Top achievements
Rank 1
Devika asked on 22 Jun 2009, 06:21 AM
Hi,

I have a combobox inside a GridView. Gridview is binded to a collection(Steps) in the viewmodel. I want to bind the combo inside the grid to bind to another collection(AllEmbeddedTables). It is not working for me. Please help.

 

<Controls:RadGridView Name="RateTableGrid" AutoGenerateColumns="False" ColumnsWidthMode="Fill" Grid.Row="0" Margin="8,2,2,8"   
                              Height="700" VerticalAlignment="Top" ItemsSource="{Binding Steps}">  
            <Controls:RadGridView.Columns> 
                <Controls:GridViewDataColumn HeaderText="Step" UniqueName="StepNumber" HeaderTextAlignment="Center" Width="75" IsReadOnly="True" DataMemberBinding="{Binding StepNumber}"/>  
 
                <Controls:GridViewDataColumn HeaderText="age" UniqueName="Age" HeaderTextAlignment="Center" TextAlignment="Right"  DataMemberBinding="{Binding Age}"/>  
                <Controls:GridViewDataColumn HeaderText="Balance Type" UniqueName="BalanceType" HeaderTextAlignment="Center" Width="100" DataMemberBinding="{Binding BalanceType}" /> 
                <Controls:GridViewDataColumn HeaderText="Amount" UniqueName="StepAmount" HeaderTextAlignment="Center" DataMemberBinding="{Binding StepAmount}"/>  
                <Controls:GridViewDataColumn TextAlignment="Right" HeaderText="Percent" UniqueName="StepPercent" HeaderTextAlignment="Center" DataMemberBinding="{Binding StepPercent}"/>  
                <Controls:GridViewDataColumn HeaderText="Embedded Tables">  
                    <Controls:GridViewDataColumn.CellStyle> 
 
                        <Style TargetType="GridView:GridViewCell">  
                            <Setter Property="Template">  
                                <Setter.Value> 
                                    <ControlTemplate TargetType="GridView:GridViewCell">  
                                        <telerikComboBox:RadComboBox ItemsSource="{Binding EmbeddedTables}" DisplayMemberPath="Name" SelectedItem="{Binding Path=SelectedTable, Mode=TwoWay}">  
 
                                        </telerikComboBox:RadComboBox> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                        </Style> 
                    </Controls:GridViewDataColumn.CellStyle> 
                </Controls:GridViewDataColumn> 
            </Controls:RadGridView.Columns> 
        </Controls:RadGridView> 

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 25 Jun 2009, 08:26 AM
Hi Devika,

The attached example demonstrates a way to have ComboBoxes in the RadGridView with different items source per each row.

Let me know if you need further assistance adapting this to your project.


Best wishes,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Devika
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or