Also adding a little more requirement in it. Limiting the number but at the same time allowing new drops - it is like let the new drops come in but the old drops (beyond certain limit) will go out automatically.
0
Kalin
Telerik team
answered on 24 Jun 2014, 10:20 AM
Hello Andy,
I'm not completely sure if I understand correctly your question. Regarding the first one if you need to cancel or confirm the drop depending on confirmation from the user - you can do that in the Drop handler of the targeted ListBox. Inside of the handler you can show a MessageBox for example and if the drop is not confirmed to handle the event by setting the e.Handled to true. For example check the following code snippet:
var messageBoxResult = MessageBox.Show("Are you sure?", "Drop Confirmation", System.Windows.MessageBoxButton.YesNo);
if (messageBoxResult == MessageBoxResult.Yes)
{
// custom drop logic
}
// in both cases handle the event
e.Handled = true;
}
As for the second question, I'll ask you to share some more information on the desired scenario as it is not completely clear. If need to keep only particular number of items as ItemsSource of the target ListBox you would need to manually remove one and add the new one in the Drop handler.
Hope this helps.
Regards,
Kalin
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.