RadCombobox Clear selection return invalid value

6 posts, 0 answers
  1. saurabh
    saurabh avatar
    2 posts
    Member since:
    Aug 2011

    Posted 04 Aug 2011 Link to this post

    I am using a RadComboBox in my silverlight application. On the selection of item, we fill other control i.e TextBox in my case (Like based on selection of template display corrosponding value in Narrativ TextBox Field). when I select "clear Button" of combobox I want to clear TextBox Too.Suppose I select the first value from the combobox and based on that it set corrosponding value in textbox. But when I select clear button it return previous value or First Value of selected combobox. So I have implemented the following code :

    <telerik:RadComboBox x:Name="notetemplate"

     

     

    IsEnabled="{Binding IsNoteTypeEnabled, Mode=TwoWay}"

     

    ItemsSource="{Binding FilteredNoteTemplates, Mode=TwoWay}"

     

    DisplayMemberPath="NoteTypeKey"

     

    SelectedValuePath="NoteTemplateId"

     

    SelectedValue="{Binding NoteTemplateId, Mode=TwoWay}"

     

    Command="{Binding NoteTemplateCommand}"

     

    HorizontalAlignment="Stretch"

     

    Style="{StaticResource McRadComboBoxStyle}"

     

    TabIndex="2"

    ClearSelectionButtonVisibility="Visible" ClearSelectionButtonContent="Clear"
    />

     
    I am using MVVM Pattern :

    private

     

     

    Guid _noteTemplateId;

     

    public Guid NoteTemplateId

    {

     

    get

    {

     

    if (_noteTemplateId == Guid.Empty)

    {

    Narrative =

     

    string.Empty;

    }

    NotifyPropertyChanged(

     

    "Narrative");

     

    return _noteTemplateId;

    }

     

    set

    {

    _noteTemplateId =

     

    value;

    }

    }

    Onselection of clear button it should return GUID.Empty but all the time it return pervious selected value. so plese let me know how can we implement my logic.

     

     

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Aug 2011 Link to this post

    Hi Saurabh,

    I've tried to reproduce this issue,  but without much success, please check the attached project for a reference.
    If you still experience the issue, please send us a runnable code where it can be reproduced.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Eric
    Eric avatar
    17 posts
    Member since:
    Aug 2011

    Posted 13 Sep 2011 Link to this post

    I have the same scenario that is listed above.
    EXCEPT i have 2 Combo boxes

    One (State) as a String as the Selected Value  and works as expected
    the Second one as an Integer as the Selected Value and demonstrates the same issue
    When you hit Clear Selection that textbox is cleared, but the updated value is not passed to the MVVM.

    Any help on how to fix this would be greatly appreciated.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Sep 2011 Link to this post

    Hello Eric,

    Could you please open a support ticket and send us a simple project demonstrating this issue there? Thanks

    Best wishes,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Henri
    Henri avatar
    74 posts
    Member since:
    Aug 2008

    Posted 07 Oct 2011 Link to this post

    I have the same issue.

    <

    telerik:RadComboBox
    ItemsSource
    ="{Binding SomeObjects}"

     ClearSelectionButtonVisibility="Visible"

     ClearSelectionButtonContent="No filter"

     DisplayMemberPath="Stringproperty"

     SelectedValuePath="IntegerProperty"

     SelectedValue="{Binding SelectedInteger, Mode=TwoWay}"

     Margin="0,0,0,8"/>

     


    When selecting 'No Filter' (thus clear), the view model is not called.
    (using latest int.build 2011.2.1004.1040)

    Update: Forget it, the reason is that clear will try to set null to the SelectedInteger and this fails.
    Using an int? in the viewmodel, then no problem.

    Henri
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Oct 2011 Link to this post

    Hello Henri,

    I'm glad you could find the solution by yourself.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner