This is killing me right now. Any ideas?
7 Answers, 1 is accepted
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.
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?
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.
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.
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.
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" >
<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="" />
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.