/// <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(); }
private void SubscribeToDragDropEvents() { RadDragAndDropManager.AddDropQueryHandler(this.AssociatedObject, OnDropQuery); RadDragAndDropManager.AddDropInfoHandler(this.AssociatedObject, OnDropInfo); RadDragAndDropManager.AddDragQueryHandler(this.AssociatedObject, OnDragQuery); RadDragAndDropManager.AddDragInfoHandler(this.AssociatedObject, OnDragInfo); }
/// <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); }
/// <summary> /// Called after the behavior is attached to an AssociatedObject. /// </summary> protected override void OnAttached() { if (AllowDrag) { RadDragAndDropManager.SetAllowDrag(AssociatedObject, true); RadDragAndDropManager.AddDragQueryHandler(AssociatedObject, OnDragQuery); RadDragAndDropManager.AddDragInfoHandler(AssociatedObject, OnDragInfo); } }
private void ItemsControl_Loaded(object sender, RoutedEventArgs e) { RadDragAndDropManager.RemoveDragQueryHandler(sender as DependencyObject, Video_DragQuery); RadDragAndDropManager.AddDragQueryHandler(sender as DependencyObject, Video_DragQuery); }