I have the following XAML code:
<telerik:RadMultiColumnComboBox
VerticalAlignment="Top"
Width="250"
DisplayMemberPath="Name"
IsReadOnly="True"
SelectionMode="Single"
SelectionBoxesVisibility="Hidden"
CloseDropDownAfterSelectionInput="True"
DropDownWidth="320"
SelectedItem="{Binding SelectedMandant}">
<telerik:RadMultiColumnComboBox.ItemsSourceProvider>
<telerik:GridViewItemsSourceProvider ItemsSource="{Binding MandantCollection}" AutoGenerateColumns="False" RowIndicatorVisibility="Hidden">
<telerik:GridViewItemsSourceProvider.Columns>
<telerik:GridViewDataColumn Header="Mandant" DataMemberBinding="{Binding Path=Name}"/>
<telerik:GridViewDataColumn
Header="Letzter Abschluss"
DataMemberBinding="{Binding Path=FibuAbschluss}"
DataFormatString="{} {0:dd.MM.yyyy}"
TextAlignment="Center"
HeaderTextAlignment="Center"/>
</telerik:GridViewItemsSourceProvider.Columns>
</telerik:GridViewItemsSourceProvider>
</telerik:RadMultiColumnComboBox.ItemsSourceProvider>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding EventName="SelectionChanged" Command="{Binding SelectedMandantChangedCmd}" RaiseOnHandledEvents="True" PassEventArgsToCommand="True"/>
</telerik:EventToCommandBehavior.EventBindings>
</telerik:RadMultiColumnComboBox>
Now everything works fine beside that the first time when the UI is rendered, the RadMultiColumnComboBox Input does not show the current selected item.
I set the SelectedItem in the constructor of my view model:
private Mandant? _selectedMandant;
public Mandant? SelectedMandant
{
get => _selectedMandant;
set
{
_selectedMandant = value;
OnPropertyChanged();
}
}
public KontoViewModel(CommonDbContext commonDbContext, StruebyWinBContext winBContext)
{
......
if(MandantCollection.Count > 0)
{
SelectedMandant = MandantCollection[0];
......
}
.......
}
I see that the SelectedMandat has a value and also it works fine after i select another item, then the item shows.
But the first time after loading, the RadMultiColumnComboBox Input does not show any value, its empty.
It should show the selected item that i set in the constructor of my view model.
Can anyone help me here, thanks