Style Radcombobox watermark/emptytext

2 posts, 0 answers
  1. Mads
    Mads avatar
    25 posts
    Member since:
    Nov 2014

    Posted 15 Sep 2015 Link to this post

    I want to add a style to the emptytext of the radcombobox that works across the entire application. 

     From what I can see I have to use but if I use 

    <DataTemplate x:Key="EmptyTemplate">
     <TextBlock FontWeight="Bold" FontFamily="Comic Sans" FontStyle="Italic" Text="Please select an agency" />
     Then I cant specify the text in the control that uses it like

    <telerik:RadComboBox Grid.Column="3"
                                     SelectedItem="{Binding Path=CreateVetPcrTestSignup.SelectedVetPcrTestKit}"
                                     EmptySelectionBoxTemplate="{StaticResource EmptyTemplate}"
                                     EmptyText="{x:Static localization:SignupTexts.PcrKitDefaultValue}"
                                     ItemsSource="{Binding Path=PcrTestKits}" />


    I want {x:Static localization:SignupTexts.PcrKitDefaultValue} to be used here, but I of course get "Please select an agency", I tried removing the name from the template, but then its just empty. Is there a way to parse the empty text into the template or use a styling somehow that only affects the emptytext?

  2. Nasko
    Nasko avatar
    556 posts

    Posted 18 Sep 2015 Link to this post

    Hello Mads,

    In order to apply the desired Template for the EmptyText and at the same time preserve its value the Text property of the TextBlock placed inside the DataTemplate should be bound to the EmptyText property of RadComboBox.

    We have created a sample project that demonstrates that and you could run and evaluate it.

    Hopes this helps.

    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
  3. DevCraft banner
Back to Top