3 Answers, 1 is accepted
0
Hello Veeraguru,
There are two possible solutions that I can suggest you to satisfy such requirement.
The first one would be to utilize the MaxDropDownHeight property of the control. You can take a look at the Key Properties topic for further reference.
The other suggestion consists of simply defining a second collection that contains only the needed items from the original source collection and bind the ItemsSource of the control to it. Note, that with such an approach, you will have to manually synchronize the two collections when needed.
I hope this helps.
Regards,
Stefan X1
Telerik by Progress
There are two possible solutions that I can suggest you to satisfy such requirement.
The first one would be to utilize the MaxDropDownHeight property of the control. You can take a look at the Key Properties topic for further reference.
The other suggestion consists of simply defining a second collection that contains only the needed items from the original source collection and bind the ItemsSource of the control to it. Note, that with such an approach, you will have to manually synchronize the two collections when needed.
I hope this helps.
Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Veeraguru
Top achievements
Rank 1
answered on 09 Mar 2017, 09:21 AM
First one :
MaxDropDownHeight - we are just restricting the height.
Second one :
I am not sure this will help me.
****************************************************************
Again I am explaining my scenario.
I have countries list which is binding to the RadAutoCompleteBox.
User can select any country but maximum 5 (for example).
How to restrict the user to select the 6th country.
0
Hi Veeraguru,
Thanks for the clarification.
It seems that I have misunderstood you initially. Please, excuse me for that.
Unfortunately, the control does not provide an out-of-the-box mechanism for disabling its selection. A possible workaround would be to subscribe to the SelectionChanged event of the control, cast the SelectedItems to IList and remove the needed item. Please, check the following code snippet as an example.
Hopefully, this helps.
Best Regards,
Stefan X1
Telerik by Progress
Thanks for the clarification.
It seems that I have misunderstood you initially. Please, excuse me for that.
Unfortunately, the control does not provide an out-of-the-box mechanism for disabling its selection. A possible workaround would be to subscribe to the SelectionChanged event of the control, cast the SelectedItems to IList and remove the needed item. Please, check the following code snippet as an example.
private
void
RadAutoCompleteBox_SelectionChanged(
object
sender,
SelectionChangedEventArgs e)
{
var source = (
this
.autoComplete.ItemsSource
as
ObservableCollection<Club>);
var list =
this
.autoComplete.SelectedItems
as
IList;
if
(e.AddedItems[0] == source.ElementAt(0))
{
list.Remove(e.AddedItems[0]);
}
}
Hopefully, this helps.
Best Regards,
Stefan X1
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.