Explicit UpdateSource in Radcombobox?

2 posts, 0 answers
  1. gokulnath
    gokulnath avatar
    2 posts
    Member since:
    Apr 2011

    Posted 12 Apr 2011 Link to this post

    Hello Telerik,
                           I have one clarification in radcombobox..
    How to get Values when Focus is in RadcomboBox?
    <telerik:RadComboBox IsEditable="True" Text="{Binding Path=District,Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Margin="103,5,33,0" Name="rcboDistrict" TabIndex="8" FontSize="11" IsDropDownOpen="False" Grid.Column="2" Grid.Row="1" VerticalAlignment="Top" Height="24" />
    In XAML i am setting UpdateSourceTrigger=LostFocus..
    if suppose focus is in Radcombobox and client will save the detail.That time radcombobox value not getting..

    in this project i am using radmenu for displaying Save,Modify Items..If suppose Focus is in TextBox mean i am Updating manually from the following Code..
    this.Dispatcher.BeginInvoke(new Action(() =>
                      if (Keyboard.FocusedElement.GetType() == typeof(TextBox))
                         BindingExpression exprLastName = ((TextBox)Keyboard.FocusedElement).GetBindingExpression(TextBox.TextProperty);

    My problem is i want to Update radComboBox also
    The above code i am changing RadComboBox instead of TextBox..But its not working...
    I find Debugging in runtime
    KeyBoard.FocusedElement.GetType() value is PickerTextBox... But focus is in radComboBox

    I don't know why pickerTextBox Comes instead of radcomboBox ?
    How to update radCombobox value? any suggestions are more welcome...
    (I know UpdateSourceTrigger=PropertyChanged .Here i don't want Bcoz i am doing validation in Business object level.
    if suppose i am using Property changed each and every character its goes validation thats why i am avoiding..)
  2. Pana
    Pana avatar
    748 posts

    Posted 18 Apr 2011 Link to this post


    I would not recomment the following approach but I can find other solution for your problem.

    RadComboBox has several controls inside its ControlTemplate - TextBox (PickerTextBox), ToggleButton (the drop down button), Popup, Clear Button etc. When you click in the RadComboBox you actually focus the PickerTextBox inside. To get the RadComboBox that the picker belongs to you can use the ParentOfType<RadComboBox>() extension method from Telerik.Windows.Controls. For example:

    UIElement pickerTextBox = Keyboard.FocusedElement.GetType() as UIElement;
    if (pickerTextBox != null)
        RadComboBox combo = pickerTextBox.ParentOfType<RadComboBox>();
        if (combo != null)
            // Do some work with the combo

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top