Beispiel #1
0
 private void UnsubscribeFromDragDropEvents()
 {
     RadDragAndDropManager.RemoveDropQueryHandler(this.AssociatedObject, OnDropQuery);
     RadDragAndDropManager.RemoveDropInfoHandler(this.AssociatedObject, OnDropInfo);
     RadDragAndDropManager.RemoveDragQueryHandler(this.AssociatedObject, OnDragQuery);
     RadDragAndDropManager.RemoveDragInfoHandler(this.AssociatedObject, OnDragInfo);
 }
Beispiel #2
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. In simplest terms, this means the method is called just before a UI element displays in an application. For more information, see Remarks.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _resultsGrid    = GetTemplateChild("PART_ResultsGrid") as RadGridView;
            _popup          = GetTemplateChild("PART_Popup") as Popup;
            _searchTextBox  = GetTemplateChild("PART_SearchTextBox") as TextBox;
            _popupTarget    = GetTemplateChild("PART_PopupTarget") as Grid;
            _dropDownButton = GetTemplateChild("Part_DropDown") as RadToggleButton;
            _resultsGrid.SelectionChanged += ResultsGridSelectionChanged;
            _searchTextBox.GotFocus       += SearchTextBox_GotFocus;
            _searchTextBox.LostFocus      += SearchTextBox_LostFocus;
            _searchTextBox.KeyDown        += SearchTextBox_KeyDown;
            _popup.Opened += Popup_Opened;
            RadDragAndDropManager.AddDragQueryHandler(_resultsGrid, OnDragQuery);
            UpdatePopupAlignment();
            UpdateRowStyle();

            if (!string.IsNullOrEmpty(QuickSearchText))
            {
                VisualStateManager.GoToState(this, "WatermarkInvisible", true);
            }
            VisualStateManager.GoToState(this, "KeywordSearch", true);
            BindingValidationError += (s, e) => UpdateValidationState();
            UpdateValidationState();
        }
Beispiel #3
0
        private void OnDragQuery(object sender, DragDropQueryEventArgs e)
        {
            if (e.Options.Status == DragStatus.DragQuery)
            {
                e.QueryResult = true;
                e.Handled     = true;

                var sourceControl = e.Options.Source;

                var dragCue = RadDragAndDropManager.GenerateVisualCue(sourceControl);
                dragCue.HorizontalAlignment        = HorizontalAlignment.Left;
                dragCue.Content                    = sourceControl.DataContext;
                dragCue.ContentTemplate            = App.Current.Resources["TrackDragCueTemplate"] as DataTemplate;
                dragCue.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;
                e.Options.DragCue                  = dragCue;

                e.Options.Payload = new DragDropOperation()
                {
                    Payload = sourceControl.DataContext
                };
            }

            if (e.Options.Status == DragStatus.DropSourceQuery)
            {
                e.QueryResult = true;
                e.Handled     = true;
            }
        }
 private void AssociatedObject_RowLoaded(object sender, RowLoadedEventArgs e)
 {
     if (AllowDrag)
     {
         RadDragAndDropManager.SetAllowDrag(e.Row, true);
     }
 }
Beispiel #5
0
 private void SubscribeToDragDropEvents()
 {
     RadDragAndDropManager.AddDropQueryHandler(this.AssociatedObject, OnDropQuery);
     RadDragAndDropManager.AddDropInfoHandler(this.AssociatedObject, OnDropInfo);
     RadDragAndDropManager.AddDragQueryHandler(this.AssociatedObject, OnDragQuery);
     RadDragAndDropManager.AddDragInfoHandler(this.AssociatedObject, OnDragInfo);
 }
        /// <summary>
        /// Called after the behavior is attached to an AssociatedObject.
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();

            RadDragAndDropManager.SetAllowDrag(AssociatedObject, false);

            AssociatedObject.RowLoaded += AssociatedObject_RowLoaded;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AppointmentItemsControl"/> class.
        /// </summary>
        public AppointmentItemsControl()
        {
            this.ResizeManager = new AppointmentResizeManager(this);

            this.SelectedAppointments = new SelectedAppointmentCollection();

            RadDragAndDropManager.AddDragQueryHandler(this, this.OnAppointmentItemsControlDragQuery);
        }
Beispiel #8
0
 private void InitializeRowDragAndDrop(GridViewRow row)
 {
     if (row == null)
         return;
     row.SetValue(RadDragAndDropManager.AllowDragProperty, true);
     row.SetValue(RadDragAndDropManager.AllowDropProperty, true);
     RadDragAndDropManager.RemoveDropQueryHandler(row, OnGridViewRowDropQuery);
     RadDragAndDropManager.AddDropQueryHandler(row, OnGridViewRowDropQuery);
 }
 private void AssociatedObject_RowLoaded(object sender, RowLoadedEventArgs e)
 {
     if (AllowDrop)
     {
         RadDragAndDropManager.SetAllowDrop(e.Row, true);
         RadDragAndDropManager.AddDropQueryHandler(e.Row, OnDropQuery);
         RadDragAndDropManager.AddDropInfoHandler(e.Row, OnDropInfo);
     }
 }
        public DragAndDropListBox()
        {
            this.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler <DragDropQueryEventArgs>(OnDragQuery));
            this.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler <DragDropQueryEventArgs>(OnDropQuery));
            this.AddHandler(RadDragAndDropManager.DropInfoEvent, new EventHandler <DragDropEventArgs>(OnDropInfo));
            this.AddHandler(RadDragAndDropManager.DragInfoEvent, new EventHandler <DragDropEventArgs>(OnDragInfo));

            RadDragAndDropManager.SetAllowDrop(this, true);
        }
Beispiel #11
0
        /// <summary>
        /// Called after the behavior is attached to an AssociatedObject.
        /// </summary>
        protected override void OnAttached()
        {
            if (AllowDrop)
            {
                RadDragAndDropManager.SetAllowDrop(AssociatedObject, true);

                RadDragAndDropManager.AddDropQueryHandler(AssociatedObject, OnDropQuery);
                RadDragAndDropManager.AddDropInfoHandler(AssociatedObject, OnDropInfo);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Called when [drag info].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Telerik.Windows.Controls.DragDrop.DragDropEventArgs"/> instance containing the event data.</param>
        protected virtual void OnDragInfo(object sender, DragDropEventArgs e)
        {
            e.Handled = true;

            if (e.Options.Status == DragStatus.DragInProgress)
            {
                var cue = RadDragAndDropManager.GenerateVisualCue();
                cue.Content = e.Options.Payload;
                if (DragContentTemplate != null)
                {
                    cue.ContentTemplate = DragContentTemplate;
                }
                e.Options.DragCue = cue;
            }
        }
 // OnDragQuery event handler
 private void OnDragQuery(object sender, DragDropQueryEventArgs e)
 {
     if (e.Options.Status == DragStatus.DragQuery && Keyboard.Modifiers == ModifierKeys.Control)
     {
         var draggedItem = e.Options.Source;
         e.QueryResult = true;
         e.Handled     = true;
         //RadMap1.mous
         // Create Drag and Arrow Cue
         ContentControl dragCue = new ContentControl();
         dragCue.Content         = draggedItem.DataContext;
         dragCue.ContentTemplate = this.gridMain.Resources["F1"] as DataTemplate;
         e.Options.DragCue       = dragCue;
         e.Options.ArrowCue      = RadDragAndDropManager.GenerateArrowCue();
         // Set the payload (this is the item that is currently dragged)
         e.Options.Payload = draggedItem.DataContext;
     }
     if (e.Options.Status == DragStatus.DropSourceQuery)
     {
         e.QueryResult = true;
         e.Handled     = true;
     }
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppointmentItem"/> class.
 /// </summary>
 public AppointmentItem()
 {
     RadDragAndDropManager.AddDragInfoHandler(this, this.OnAppointmentItemDragInfo);
 }
 private void ItemsControl_Loaded(object sender, RoutedEventArgs e)
 {
     RadDragAndDropManager.RemoveDragQueryHandler(sender as DependencyObject, Video_DragQuery);
     RadDragAndDropManager.AddDragQueryHandler(sender as DependencyObject, Video_DragQuery);
 }
 protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
 {
     base.PrepareContainerForItemOverride(element, item);
     RadDragAndDropManager.SetAllowDrag(element, true);
 }
 private void InitializeTemplateDropTargetList(ListBox listBox)
 {
     RadDragAndDropManager.AddDropQueryHandler(listBox, DropTargetHelper.OnDropQuery);
     RadDragAndDropManager.AddDropInfoHandler(listBox, DropTargetHelper.OnDropInfo);
 }
Beispiel #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeSlotItemsControl"/> class.
 /// </summary>
 public TimeSlotItemsControl()
 {
     RadDragAndDropManager.AddDropInfoHandler(this, this.OnTimeSlotItemsControlDropInfo);
     RadDragAndDropManager.AddDropQueryHandler(this, this.OnTimeSlotItemsControlDropQuery);
 }