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

Applying a theme to a RadMultiColumnComboBoxElement

3 Answers 129 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ricardo Romo
Top achievements
Rank 1
Ricardo Romo asked on 18 Nov 2010, 06:53 PM
Hi,

I am applying a theme to the dropDownElement of a RadMulticolumnComboBox column. But it is not applyed until the second time the dropDownElement is displayed. How can I do it to apply it all the times, including the first time.

I have tried to do this in two events. Here is the code if I use CellEditorInitialized:

Private Sub Grid_CellEditorInitialized(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles Grid.CellEditorInitialized
  
    If e.Row.Cells(e.ColumnIndex).ColumnInfo.Name = "multiComboGrupo" Then
            Dim editor As RadMultiColumnComboBoxElement = CType(Grid.ActiveEditor, RadMultiColumnComboBoxElement)
            editor.EditorControl.ThemeName = "UYA_Multicolu"  
    End if
  
End Sub

I even tryed with CellBeginEdit event:

Private Sub Grid_CellBeginEdit(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewCellCancelEventArgs) Handles Grid.CellBeginEdit 
    
    If Grid.CurrentRow.Cells(e.ColumnIndex).ColumnInfo.Name = "multiComboGrupo" Then
            Dim editor As RadMultiColumnComboBoxElement = CType(Grid.ActiveEditor, RadMultiColumnComboBoxElement) 
            editor.EditorControl.ThemeName = "UYA_Multicolu"  
    End if 
    
End Sub

Thank you.

3 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Nov 2010, 09:02 AM
Hello Ricardo,

First i have to ask, are you trying to use a different themes / controls, or a theme for the entire application? If you are trying to use just one theme for the entire app, you can just set the theme in the ThemeResolutionService, like so:
ThemeResolutionService.ApplicationThemeName = "Desert";

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Ricardo Romo
Top achievements
Rank 1
answered on 19 Nov 2010, 04:43 PM
Hi!

Thank you for answer. I am applying different themes for controls. Not for the entire application. It works, but until the second time the dropdown element is showed.

I also loaded the thems from files in RadThemeManager for the form where I have the RadGridView with the MultiColumnComboBox Column.

Thank you for your help.
0
Stefan
Telerik team
answered on 24 Nov 2010, 11:44 AM
Hello Ricardo,

Thank you for writing.

The observed behavior is caused by the fact that our theming mechanism works per control, but not per element. You can't set a theme to RadMultiColumnComboBox different than the theme of its dropdown element.

However, the desired behavior can be achieved by setting a theme to the embedded control instead of its element. Please refer to the following code snippet:
Dim editor As New RadMultiColumnComboBoxElement
Private Sub Grid_CellEditorInitialized(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellEditorInitialized
    If e.Row.Cells(e.ColumnIndex).ColumnInfo.Name = "OrderID" Then
        editor = CType(RadGridView1.ActiveEditor, RadMultiColumnComboBoxElement)
        AddHandler editor.PopupOpened, AddressOf PopUpOpenedEvent
 
    End If
End Sub
Private Sub PopUpOpenedEvent()
    editor.EditorControl.ThemeName = "HighContrastBlack"
End Sub

I hope the provided information addresses your question. Should you need any further assistance, do not hesitate to contact me.

Regards,
Stefan
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
GridView
Asked by
Ricardo Romo
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Ricardo Romo
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or