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

Different ItemSource property in RadGridView and ComboBox

3 Answers 31 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mathan lal
Top achievements
Rank 1
Mathan lal asked on 22 Mar 2010, 03:55 PM
Hi,

We are using ComboBox on the Column Header of RadGridView.
Is there any way to use different Item Source property for RadGridView and ComboBox?

Thanks & Regards,
Mathanlal A.J.

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 22 Mar 2010, 03:57 PM
Hi Mathan lal,

You can set any source to the combo, since you are creating it. For example:

RadComboxBox myCombo = new RadComboBox();
myCombo.ItemsSource = <<somethig>>
this.radGridView.Columns[0].Header = myCombo.

I hope this helps.

All the best,
Ross
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
Mathan lal
Top achievements
Rank 1
answered on 23 Mar 2010, 08:42 AM
Ross,

Thanks for your quick response. I appreciate it.

As you mentioned, it works fine in dynamic creation of combobox.

Just I want to know about the same in the design time creation.

For eg. find some code snippets like below.

 

 

<

 

telerikGridView:RadGridView x:Name="dgEmpEarnings"
CanUserResizeColumns="False"

 

 

MultipleSelect="False"

 

 

DataLoadMode="Asynchronous"

 

 

AreRowDetailsFrozen="True"

 

 

ItemsSource="{Binding empEarnHistoryDetail, Mode=TwoWay}"

 

 

IsReadOnly="True"

 

 

AutoGenerateColumns="False"

 

 

VerticalAlignment="Stretch"

 

 

ColumnsWidthMode="Fill"

 

 

CanUserFreezeColumns="False"

 

 

UseAlternateRowStyle="True"

 

 

ColumnBackground="{x:Null}"

 

 

ShowGroupPanel="False"

 

 

RowIndicatorVisibility="Collapsed"

 

 

ScrollMode="RealTime"

 

 

Style="{StaticResource RadGridViewSettings}"

 

 

Background="#E1EEFF"

 

 

GridLinesVisibility="Vertical"

 

 

>

 

 

 

<telerikGridView:RadGridView.Columns>

 


<telerikGridView:GridViewDataColumn x:Name="ColHistDescription" UniqueName="dgColHistDescription"                                                        
                                                     Header="Description"   
                                                     HeaderTextAlignment="Center">  
                            <telerikGridView:GridViewDataColumn.HeaderCellStyle> 
                                <Style TargetType="Telerik_Windows_Controls_GridView:GridViewHeaderCell">  
                                    <Setter Property="Template">  
                                        <Setter.Value> 
                                            <ControlTemplate TargetType="Telerik_Windows_Controls_GridView:GridViewHeaderCell">  
                                                <ComboBox x:Name="cmbDescription" HorizontalAlignment="Stretch" Height="20"                                                             
                                                    SelectedIndex="0"   
                                                    ItemsSource="{Binding ActiveEarnings}" 
                                                    DisplayMemberPath="LongTitle">  
 
                                                </ComboBox> 
                                            </ControlTemplate> 
                                        </Setter.Value> 
                                    </Setter> 
                                </Style> 
                            </telerikGridView:GridViewDataColumn.HeaderCellStyle> 
                            <telerikGridView:GridViewDataColumn.CellTemplate> 
                                <DataTemplate> 
                                    <TextBlock x:Name="txtblkDesc" Text="{Binding EarnDescription}"  Margin="5,0,0,0" ></TextBlock>  
                                </DataTemplate> 
                            </telerikGridView:GridViewDataColumn.CellTemplate> 
                        </telerikGridView:GridViewDataColumn> 

</

 

telerikGridView:RadGridView.Columns>

 

 

 

</telerikGridView:RadGridView>

 

 

 

 

 


Please let me know if it is possible.
 
Thanks & Regards,
Mathanlal A.J.

 

0
Rossen Hristov
Telerik team
answered on 23 Mar 2010, 09:19 AM
Hi Mathan lal,

I doubt that this will be possible, since the Combo is inside a Control template. But what you can do is the following. Attach to the combo's Loaded event. Then in the event handler set its ItemsSource to the correct thing. I hope this helps.

Kind regards,
Ross
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
GridView
Asked by
Mathan lal
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Mathan lal
Top achievements
Rank 1
Share this question
or