Bind SelectedItem to null

8 posts, 0 answers
  1. Peter
    Peter avatar
    7 posts
    Member since:
    May 2011

    Posted 09 Aug 2013 Link to this post

    Am I missing something or can I not have a null value for the SelectedItem. Binding the ItemsSource automatically selects the first item.

    This is killing me right now. Any ideas?
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 12 Aug 2013 Link to this post

    Hi Peter,

    Thank you for contacting us. While developing the ListPicker control we followed the Microsoft Design Guidelines and designed the control to have at least one selected item. I agree that there are scenarios in which an empty selection might be necessary. I've added an item in our backlog and we will do our best to improve the control in the next versions of the suite.
    In the meantime, you can try setting the ItemsSource property to null. This will automatically set the SelectedItem to null as well.

    Regards,
    Kiril Stanoev
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. catqbat
    catqbat avatar
    9 posts
    Member since:
    Jun 2013

    Posted 10 Jul 2014 Link to this post

    Hi,
    Are there any news concerning this issue?

    I'm developing an app where one of the use case involves editing a business object. Many of it's properties are optional but come from predefined lists. When property is null the ListPicker automatically selects the first item and changes my view model :( This is a major flaw. I'm forced to use some ugly hacks, like inserting fake item at the first index saying "No selection". This looks bad. 
    The ListPicker exposes dependency property called "NoSelectionContent", so in what cases will this content be visible? Am I missing somehing here?
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 16 Jul 2014 Link to this post

    Hi,

    Currently NoSelectionContent will work only for Multiple and Extended selection mode. Our developers are currently working on the problem. Please, open a formal support ticket, so that we can provide you with a custom build, when the issue is fixed.

    Best regards,
    Ves
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Rob
    Rob avatar
    11 posts
    Member since:
    Jan 2013

    Posted 17 Nov 2015 Link to this post

    What is the status of this? Is there currently a way to have no selection in the ListPicker, in conjunction with NoSelectionContent?
  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 24 Nov 2015 Link to this post

    Hi Rob,

    The fix has been included since Q3 2014, as described in our Release History. Note, that due to the nature of the control, it is only available in popup mode.

    Best regards,
    Ves
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  8. Rob
    Rob avatar
    11 posts
    Member since:
    Jan 2013

    Posted 24 Nov 2015 in reply to Ves Link to this post

    When I attempt to set the "SelectedValue" property to null, I get an exception "Value does not fall within the expected range."

     

                        <telerikInput:DataField TargetProperty="TimeLimit" Header="Time Limit" >
                            <telerikInput:DataField.EditorStyles>
                                <Style TargetType="telerikInput:RadListPicker">
                                    <Setter Property="PopupHeader" Value="Limit"/>
                                    <Setter Property="DisplayMemberPath" Value="Description" />
                                    <Setter Property="SelectedValuePath" Value="Id" />
                                    <Setter Property="NoSelectionContent" Value="-select-"/>
                                    <Setter Property="InlineModeThreshold" Value="0" />
                                    <Setter Property="SelectedValue" Value="" />
                                </Style>
                            </telerikInput:DataField.EditorStyles>
                        </telerikInput:DataField> 

     

  9. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 27 Nov 2015 Link to this post

    Hi Rob,

    In RadDataForm the SelectedValue will be databound to the value of the corresponding property in the underlying object, so setting SelectedValue like this will be ignored. Can you please provide a full example, showing the problem, so that we can review it and get to you with the best possible suggestion.

    Best regards,
    Ves
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner