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

LookupElement combobox has a style that is not being overridden

3 Answers 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Edmund Covington
Top achievements
Rank 1
Edmund Covington asked on 29 Jan 2016, 03:54 PM

I am creating a GridViewComboBoxColumn programmatically and so am adding the CellTemplate programmatically with the code:

 

private static DataTemplate GetCellTemplate(GridColumn column, DataTemplate itemTemplate, Binding itemsSourceBinding)
{          
    FrameworkElementFactory lookupElement = new FrameworkElementFactory(typeof(LookupElement));
    if (itemsSourceBinding != null)
        lookupElement.SetBinding(LookupElementWithStyle.ItemsSourceProperty, itemsSourceBinding);
    lookupElement.SetValue(LookupElementWithStyle.ItemTemplateProperty, itemTemplate);
    lookupElement.SetValue(LookupElementWithStyle.SelectedValuePathProperty, column.MemberPath);
    lookupElement.SetBinding(LookupElementWithStyle.SelectedValueProperty, new Binding(column.DataName));
    lookupElement.SetValue(LookupElementWithStyle.IsTabStopProperty, false);
     
    DataTemplate cellTemplate = new DataTemplate()
    {
        VisualTree = lookupElement
    };
 
    cellTemplate.Seal();
    return cellTemplate;
}

The problem with this is that the LookupElement has a RadComboBox property that is displayed in the visual tree but I have no way of overriding the style. The result is that it is using the default FontFamily "Segoe UI SemiBold" when I want to use "Segoe UI", and any gridviewcomboboxcolumns are displayed as semibold. How do I overcome this?

 

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 01 Feb 2016, 01:41 PM
Hi Edmund,

The easiest way would be to create an implicit style targeting RadComboBox as follows:
<Style TargetType="telerik:RadComboBox">
            <Setter Property="FontFamily" Value="Verdana" />
        </Style>

Will that approach meet your  

Regards,
Maya
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Edmund Covington
Top achievements
Rank 1
answered on 01 Feb 2016, 02:42 PM
I already have an application wide Style for RadComboBox, but this doesn't affect the ComboBox that is a property of the LookupElement.
0
Maya
Telerik team
answered on 02 Feb 2016, 11:44 AM
Hi Edmund,

I am sending the project I used for the test. Could you give it a try and let me know whether there is anything else that I need to do for reproducing the issue?

Regards,
Maya
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Edmund Covington
Top achievements
Rank 1
Answers by
Maya
Telerik team
Edmund Covington
Top achievements
Rank 1
Share this question
or