Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. public void getphases()
  2. {
  3. foreach (var item in categoryList)
  4. {
  5.  
  6. ListBox lb = new ListBox();
  7. // lb.SelectionChanged += lb_SelectionChanged;
  8. lb.Margin = new Thickness(0, 0, 0, 0);
  9. lb.Height = 550d;
  10. lb.Name = "InnerListBox";
  11.  
  12.  
  13. lb.PreviewMouseLeftButtonDown += lb_PreviewMouseLeftButtonDown;
  14. lb.AllowDrop = true;
  15. lb.GiveFeedback += lb_GiveFeedback;
  16.  
  17. lb.DragEnter += lb_DragEnter;
  18. lb.Drop += lb_Drop;
  19. lb.DragOver += lb_DragOver;
  20. lb.BorderThickness = new Thickness(0, 0, 0, 0);
  21. BrushConverter bs = new BrushConverter();
  22.  
  23. lb.Background = (Brush)bs.ConvertFromString("#FFF3800C");
  24.  
  25. ListBoxItem lbi = new ListBoxItem();
  26. lbi.Margin = new Thickness(0, 0, 0, 0);
  27. }
  28.  
  29.  
  30.  
  31. //this event is not firing
  32. void lb_DragEnter(object sender, DragEventArgs e)
  33. {
  34. if (_dragged == null || e.Data.GetDataPresent(DataFormats.Text, true) == false)
  35. e.Effects = DragDropEffects.None;
  36. else
  37. e.Effects = DragDropEffects.All;
  38. }
  39.  
  40.  
  41. //Drag&Drop not working
  42. void lb_DragOver(object sender, DragEventArgs e)
  43. {
  44.  
  45. e.Effects = DragDropEffects.Copy;
  46.  
  47. }
  48.  
  49. <ListBox x:Name="icTodoList" local2:ProjectTabTavlaViewModel.ListBox="{Binding ElementName=icTodoList}" Background="#FFF3800C" Canvas.Top="25" Height="600" Width="{Binding ElementName=gd,Path=ActualWidth}" BorderThickness="0" BorderBrush="{x:Null}">
  50. <ListBox.Resources>
  51. <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFF3800C" Opacity="0.2"/>
  52. <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#FFF3800C" />
  53.  
  54.  
  55. </ListBox.Resources>
  56. <ListBox.ItemsPanel>
  57. <ItemsPanelTemplate>
  58. <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
  59. </ItemsPanelTemplate>
  60. </ListBox.ItemsPanel>
  61. </ListBox>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement