ComboBox - DropDownButton - DataTemplate

2 Answers 268 Views
Button General Discussions
Palmsenser
Top achievements
Rank 1
Palmsenser asked on 30 May 2022, 10:44 AM

Hallo,

I would like to customize the icon of the "ComboBox - DropDownButton"

Is there any "DataTemplate" for "ComboBox - DropDownButton"? Or any other solution?

I understand that I can customize the style in "RadComboBox.DropDownButtonStyle", but I need the customize the icon of the button

2 Answers, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 31 May 2022, 10:16 AM

Hi Paim,

You can customize the drop down button using the DropDownButtonStyle.

If you want to change the icon, then use the Text property, also you have to set the FontFamily property. 

Example:

ComboBox definition in xaml:

<telerik:RadComboBox ItemsSource="{Binding Items}"
                                 SearchTextPath="Name"
                                 DisplayMemberPath="Name"
                                 DropDownButtonStyle="{StaticResource DropDownButtonStyle}">
                <telerik:RadComboBox.BindingContext>
                    <local:ViewModel/>
                </telerik:RadComboBox.BindingContext>
</telerik:RadComboBox>

 

DropDownButtonStyle defined in the page's resource:

<ResourceDictionary>
    <Style TargetType="telerik:RadButton" x:Key="DropDownButtonStyle">
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="HorizontalOptions" Value="Center"/>
        <Setter Property="VerticalOptions" Value="Center"/>
        <Setter Property="WidthRequest" Value="30"/>
        <Setter Property="HeightRequest" Value="30"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Text" Value="&#xe809;"/>
        <Setter Property="FontFamily" Value="TelerikFontExamples"/>
        <Setter Property="BackgroundColor" Value="Transparent"/>             
        <Setter Property="TextColor" Value="Blue"/>
        <Setter Property="Padding" Value="{OnPlatform Android='8, 2, 4, 2', iOS='4, 2, 12, 2', MacCatalyst='4, 0, 8, 0', WinUI='6, 0, 10, 0'}"/>
    </Style>
</ResourceDictionary>
And the final result:

 

Regards,
Didi
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/.

0
Palmsenser
Top achievements
Rank 1
answered on 03 Jun 2022, 02:35 PM

Hallo,

I use "telerik:RadComboBox.SelectionBoxTemplate" to customize "text beside DropDownButton". It display the item correctly when the control loaded, however, if I change the selection, new selected item is not showed, ("text beside DropDownButton" is just empty).

Is there any demo example for how to use  "telerik:RadComboBox.SelectionBoxTemplate" proplerly?

Didi
Telerik team
commented on 06 Jun 2022, 10:19 AM | edited

Hi Palm,

Could you please send us a sample repro project with the exact implementation you have for the ComboBox control and the SelectionboxTemplate. In this way we can test on our side the exact behavior with the SelectionBoxTemplate. Also you can attach an image what is the desired result you want to achieve and how the control looks now. 

Tags
Button General Discussions
Asked by
Palmsenser
Top achievements
Rank 1
Answers by
Didi
Telerik team
Palmsenser
Top achievements
Rank 1
Share this question
or