The below is my XAML code:
I have followed the guide from the documentation at http://www.telerik.com/help/wpf/radlistbox-features-dragdrop.html, but it does not work. I can pickup an item from the left list, but I cannot drop it in the right list. It appears like on this image: http://i.stack.imgur.com/ADgPS.png. I also cannot reorder the ones on the left. it shows where I want to drop it, but it does not change anything. This is my code-behind:
The EntityMetaData object is from the Dynamics CRM 2011 SDK.
<Window x:Class="CrmActivityTimer.SetRegardingEntities" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="SetRegardingEntities" Height="337" Width="439" DataContext="{Binding RelativeSource={RelativeSource Self}}"> <Window.Resources> <Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem"> <Setter Property="telerik:DragDropManager.AllowDrag" Value="True"/> </Style> </Window.Resources> <Grid> <telerik:RadListBox ItemsSource="{Binding MetaData.RetrievedEntityMetaDatas}" HorizontalAlignment="Left" Height="190" Margin="10,57,0,0" VerticalAlignment="Top" Width="182" ItemContainerStyle="{StaticResource DraggableListBoxItem}" DisplayMemberPath="DisplayName.UserLocalizedLabel.Label" AllowDrop="True"> <telerik:RadListBox.DragVisualProvider> <telerik:ListBoxDragVisualProvider /> </telerik:RadListBox.DragVisualProvider> <telerik:RadListBox.DragDropBehavior> <telerik:ListBoxDragDropBehavior /> </telerik:RadListBox.DragDropBehavior> </telerik:RadListBox> <telerik:RadListBox HorizontalAlignment="Left" Height="190" Margin="239,57,0,0" VerticalAlignment="Top" Width="182" ItemsSource="{Binding MetaData.SavedEntityMetaDatas}" ItemContainerStyle="{StaticResource DraggableListBoxItem}" DisplayMemberPath="DisplayName.UserLocalizedLabel.Label" AllowDrop="True"> <telerik:RadListBox.DragVisualProvider> <telerik:ListBoxDragVisualProvider /> </telerik:RadListBox.DragVisualProvider> <telerik:RadListBox.DragDropBehavior> <telerik:ListBoxDragDropBehavior /> </telerik:RadListBox.DragDropBehavior> </telerik:RadListBox> </Grid></Window>I have followed the guide from the documentation at http://www.telerik.com/help/wpf/radlistbox-features-dragdrop.html, but it does not work. I can pickup an item from the left list, but I cannot drop it in the right list. It appears like on this image: http://i.stack.imgur.com/ADgPS.png. I also cannot reorder the ones on the left. it shows where I want to drop it, but it does not change anything. This is my code-behind:
public partial class SetRegardingEntities { public SetRegardingEntitiesMetaData MetaData { get; set; } public SetRegardingEntities() { MetaData = new SetRegardingEntitiesMetaData(); InitializeComponent(); IEnumerable<string> regardingTargets = CrmConnector.GetServiceAppointmentRegardingTargets(); List<EntityMetadata> regardingmetadataList = new List<EntityMetadata>(); foreach (string regardingTarget in regardingTargets) { regardingmetadataList.Add(CrmConnector.GetMetaDataForEntityName(regardingTarget)); } MetaData.RetrievedEntityMetaDatas = regardingmetadataList.OrderBy(metadata => metadata.DisplayName.UserLocalizedLabel.Label).ToList(); } private void btnSaveBetreft_onclick(object sender, RoutedEventArgs e) { List<string> regardingTargetsList = MetaData.SavedEntityMetaDatas.Select(savedEntityMetaData => savedEntityMetaData.LogicalName).ToList(); SettingsSaver.SaveRegardingList(regardingTargetsList); ActivityTimerContainer activityTimerContainer = new ActivityTimerContainer(); activityTimerContainer.Show(); Close(); } } public class SetRegardingEntitiesMetaData : INotifyPropertyChanged { private List<EntityMetadata> _retrievedEntityMetadatas; private List<EntityMetadata> _savedEntityMetadatas; public List<EntityMetadata> RetrievedEntityMetaDatas { get { return _retrievedEntityMetadatas; } set { if (_retrievedEntityMetadatas == value) { return; } _retrievedEntityMetadatas = value; OnPropertyChanged(); } } public List<EntityMetadata> SavedEntityMetaDatas { get { return _savedEntityMetadatas; } set { if (_savedEntityMetadatas == value) { return; } _savedEntityMetadatas = value; OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } }The EntityMetaData object is from the Dynamics CRM 2011 SDK.