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

Initial value of RadCombox with grouping

2 Answers 349 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Carsten
Top achievements
Rank 1
Veteran
Carsten asked on 01 Sep 2020, 09:23 AM
Hello,

I´m using a RadComboBox with grouping, like it works with the default ComboBox. So far so good, but the initial value is set to the first Item of the lcv. No difference when commenting out the binding for SelectedValue.

Without Grouping the initial value is null and the box is empty. Is there a way achive this behavior without adding an empty item to the collection? Because I want to use the ClearSelectionButton feature.

 
<telerik:RadComboBox ItemsSource="{Binding ArtenLcv}" SelectedValuePath="Wert" DisplayMemberPath="Text" SelectedValue="{Binding ArtSelected}"
                                             ClearSelectionButtonVisibility="{Binding SelectedValue, RelativeSource={RelativeSource Self}, Converter={StaticResource objectVisibilityConverter}}" ClearSelectionButtonContent="Clear">
    <telerik:RadComboBox.GroupStyle>
        <GroupStyle>
            <GroupStyle.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" Margin="2" IsEnabled="False" />
                </DataTemplate>
            </GroupStyle.HeaderTemplate>
        </GroupStyle>
    </telerik:RadComboBox.GroupStyle>
</telerik:RadComboBox>

 

Regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 04 Sep 2020, 08:28 AM

Hello Carsten,

Thank you for the provided information. 

This behavior is observed when the IsSynchronizedWithCurrentItem property of RadComboBox is set to True or False. I've tested the code snippet on my side and I wasn't able to reproduce the behavior because the IsSynchronizedWithCurrentItem default value is Null. I've attached my project so you can check if I am missing anything. What you can check is if the IsSynchronizedWithCurrentItem property is set somewhere else in your application. For example, in code-behind or through a Style.

Regards,
Martin Ivanov
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
Carsten
Top achievements
Rank 1
Veteran
answered on 04 Sep 2020, 09:12 AM

thank you,

when I change the initialization of the ItemsSource from

new ListCollectionView(source)

to

CollectionViewSource.GetDefaultView(source)

the inital value is not set as expected.

Tags
ComboBox
Asked by
Carsten
Top achievements
Rank 1
Veteran
Answers by
Martin Ivanov
Telerik team
Carsten
Top achievements
Rank 1
Veteran
Share this question
or