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

Unable to get Empty text to display

4 Answers 70 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Keenan
Top achievements
Rank 1
Keenan asked on 24 Jun 2019, 09:54 PM

Below is my radcombobox with checkbox multi select dropdown. 

 

<telerik:RadComboBox x:Name="StatusFilter"
                                 Width="150"
                                 Margin="10,1,10,2"
                                 HorizontalAlignment="Stretch"
                                 HorizontalContentAlignment="Left"
                                 CanAutocompleteSelectItems="True"
                                 EmptySelectionBoxTemplate="{StaticResource EmptyTemplate}"
                                 EmptyText="Status"
                                 IsEditable="False"
                                 ItemsSource="{Binding StatusesComboBox}"
                                 SelectedValue="{Binding CourseStatusId, Mode=TwoWay}"
                                 SelectedValuePath="Id">
                <telerik:RadComboBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox Height="16"
                                  Margin="0"
                                  HorizontalAlignment="Stretch"
                                  VerticalAlignment="Stretch"
                                  Content="{Binding Value.DisplayName}"
                                  IsChecked="{Binding IsSelected}" />
                    </DataTemplate>
                </telerik:RadComboBox.ItemTemplate>
                <telerik:RadComboBox.SelectionBoxTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding ItemsSource.SelectedItemsText, ElementName=StatusFilter, Mode=OneWay}" />
                    </DataTemplate>
                </telerik:RadComboBox.SelectionBoxTemplate>
            </telerik:RadComboBox>

 

 

The issue is the empty text doesn't show. It's just blank. Is there anyway to get this to show? I suspect it has to do with the custom data templates. Can anyone help me with this?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Keenan
Top achievements
Rank 1
answered on 24 Jun 2019, 10:01 PM

I can't see a way to edit my post but the EmptySelectionBoxTemplate is just the below. I was testing to see if it would help.

<DataTemplate x:Key="EmptyTemplate">
    <TextBlock FontFamily="Comic Sans"
               FontStyle="Italic"
               FontWeight="Bold"
               Text="Please select an agency" />
</DataTemplate>

 

0
Keenan
Top achievements
Rank 1
answered on 24 Jun 2019, 10:34 PM

I got it to display by removing SelectedValuePath="Id"

The issue I'm having now is when you select items, the empty text will still be there. If you click in between the items, there's a small spot, it closes the dropdown and the empty text disappears and is now filled with the selected items text. If I then unselect all the items, it's empty, probably still displaying ItemsSource.SelectedItemsText. 

 

If I remove the selectedItemsText, doing the same thing puts the last click item in the box. Perhaps this is a telerik / wpf bug?

 

 

0
Vladimir Stoyanov
Telerik team
answered on 27 Jun 2019, 02:06 PM
Hello Keenan,

Thank you for the provided code snippets and sample picture. 

Can you share whether you are using multiple selection by setting the AllowMultipleSelection property of the RadComboBox to True? If that is the case, you should utilize its MultipleSelectionBoxTemplate property. 

That said, I am uncertain what causes the behavior described in your last reply. That is why I attached a sample project I created trying to reproduce the scenario. May I ask you to modify it in order to demonstrate the behavior and send it back? You can open a new support ticket and attach it there, since such files cannot be attached to a forum post. This way I will be able to investigate the scenario and better assist you. 

Thank you in advance for any help you can provide.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Keenan
Top achievements
Rank 1
answered on 02 Jul 2019, 07:02 PM

I created a ticket with more details of the issue. 

 

Thanks

Tags
ComboBox
Asked by
Keenan
Top achievements
Rank 1
Answers by
Keenan
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or