Don't select the value of SelectedItem of the RadComboBox to RadComboBox.Text.

1 posts, 0 answers
  1. yang
    yang avatar
    47 posts
    Member since:
    Oct 2010

    Posted 15 Dec 2010 Link to this post

    Don't select the value of SelectedItem of the RadComboBox to RadComboBox.Text.
    RadComboBox is data bound to a collection of custom objects.
    The code is :
    The XAML.cs:
    WCFBusiServiceClient wcfBusiServiceClient = new WCFBusiServiceClient();
    wcfBusiServiceClient.GetSchemeDataCompleted += new EventHandler<GetSchemeDataCompletedEventArgs>(wcfBusiServiceClient_GetSchemeDataCompleted);
                wcfBusiServiceClient.GetSchemeDataAsync();
      
    void wcfBusiServiceClient_GetSchemeDataCompleted(object sender, GetSchemeDataCompletedEventArgs e)
            {
                try
                {
                    this.cmBoxScheme.ItemsSource = e.Result;
                }
                catch
                {
                    throw new NotImplementedException();
                }
            }
      
      
    The XAML:
      
    <DataTemplate x:Key="SchemeItemTemplate">
                <StackPanel Orientation="Horizontal">
                    <TextBlock  Name="txtSchemeItem" Text="{Binding SchemeName}"/>
                </StackPanel>
            </DataTemplate>
      
      
    <telerik:RadComboBox Grid.Row="0" Grid.Column="2" Width="83" Height="25" Margin="0,0,0,5" Name="cmBoxScheme" VerticalAlignment="Center" HorizontalAlignment="Left" 
                                         IsEditable="True" IsDropDownOpen="True" TextSearchMode="StartsWith" IsFilteringEnabled="True"
                                         ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="??????"
                                         IsMouseWheelEnabled="True" SelectedItem="SchemeName"
                                         ItemTemplate="{StaticResource SchemeItemTemplate}" SelectionChanged="cmBoxScheme_SelectionChanged" />



Back to Top