How to change the style of ComboBox in RadGridView.

1 Answer 30 Views
GridView
JIJIKO
Top achievements
Rank 1
Iron
JIJIKO asked on 28 Oct 2021, 09:13 AM | edited on 28 Oct 2021, 09:16 AM

How to change ComboBoxStyle in GridViewComboBoxColumn of RadGridView when i Edit the cell.

<telerik:GridViewComboBoxColumn Header="Location" DataMemberBinding="{Binding AlertLocationId}"
UniqueName="AlertLocation" SelectedValueMemberPath="Id" DisplayMemberPath="Name"
Style="{DynamicResource GridViewColumnStyle}"/>

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 02 Nov 2021, 09:10 AM

Hello JIJIKO,

To achieve your requirement, you can create a custom class that derives from GridViewComboBoxColumn and override its CreateCellEditElement() method. There you can set the Style or any other property of the created RadComboBox control.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

JIJIKO
Top achievements
Rank 1
Iron
commented on 02 Nov 2021, 10:03 AM

Does this mean i cannot set the DynamicResource as  Combobox's Style in xaml?
Martin Ivanov
Telerik team
commented on 04 Nov 2021, 12:46 PM

It looks like I mislead you a bit with the CreateCellEditElement() method. You can use it, but f you want to provide a style dynamically from XAML, you will need to expose an additional property in the custom column and pass it in code. 

However, it turns out that the EditorStyle property that comes from the GridViewBoundColumnBase class (inherited by GridViewComboBoxColumn) will work in your case.

<telerik:GridViewComboBoxColumn.EditorStyle>
	<Style TargetType="telerik:RadComboBox">
		<Setter Property="Opacity" Value="0.5" />
	</Style>
</telerik:GridViewComboBoxColumn.EditorStyle>

Tags
GridView
Asked by
JIJIKO
Top achievements
Rank 1
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or