我们在RadComboBox中加载RadGridView。当我们点击组合框时,需要花费时间。我认为由于RadGridView需要时间。 RadGridView在数据绑定中花费时间,因此组合框不会立即填充。我们想要如果尚未填充项目源,则弹出一个框“请等待产品列表加载......”。如果可能,请在该点加载列表,然后关闭该框。
<telerik:RadComboBox x:Name="partIdRadComboBox" Grid.Column="1" Height="32" Width="70" Margin="0,10,4,4" VerticalAlignment="Top"
EmptyText="-" Text="{Binding Text, Mode=TwoWay}" IsEditable="True" AllowDrop="False"
IsTextSearchEnabled="True" OpenDropDownOnFocus="True" FontSize="15" InputScope="Number">
<telerik:RadComboBox.Items>
<telerik:RadComboBoxItem>
<telerik:RadComboBoxItem.Template>
<ControlTemplate TargetType="telerik:RadComboBoxItem">
<telerik:RadGridView x:Name="RadGridView1" ShowGroupPanel="False" CanUserFreezeColumns="False"
RowIndicatorVisibility="Collapsed" IsReadOnly="True" AutoGenerateColumns="False"
IsFilteringAllowed="False" ItemsSource="{Binding Items}" IsSynchronizedWithCurrentItem="False"
Height="150" SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
RowStyle="{StaticResource ComboboxRowStyle}" HorizontalContentAlignment="Left">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding PartID}" Header="Part ID" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding ShopID}" Header="Shop ID" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding UnitRate}" Header="Base $" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding BookUnitRental}" Header="Base Rent $" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Description" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</ControlTemplate>
</telerik:RadComboBoxItem.Template>
</telerik:RadComboBoxItem>
</telerik:RadComboBox.Items>
<ie:Interaction.Triggers>
<ie:EventTrigger EventName="PreviewKeyDown">
<prism:InvokeCommandAction Command="{Binding SelectHighlightedProductCommand}"/>
</ie:EventTrigger>
</ie:Interaction.Triggers>
</telerik:RadComboBox>