当前位置: 首页>>代码示例>>C#>>正文


C# Telerik.GetPosition方法代码示例

本文整理汇总了C#中Telerik.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Telerik.GetPosition方法的具体用法?C# Telerik.GetPosition怎么用?C# Telerik.GetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Telerik的用法示例。


在下文中一共展示了Telerik.GetPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDrop

		/// <summary>
		/// Called when an items has been dropped on the surface.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="e">The <see cref="Telerik.Windows.DragDrop.DragEventArgs"/> instance containing the event data.</param>
		private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
		{
			diagram.SelectedIndex = -1;

			// this offset is necessary when multiple items are dropped at one; it keeps them separate though the same drop point is given
			var offset = 0;
#if WPF
			if (e.Data == null || !(e.Data is DataObject)) return;
			var droppedClassViewModels = (e.Data as DataObject).GetData(treeView.SelectedItems.GetType()) as IEnumerable;
#else
			if (e.Data == null || !(e.Data is IEnumerable)) return;
			var droppedClassViewModels = e.Data as IEnumerable;
#endif
			if (droppedClassViewModels == null) return;
			foreach (var viewModel in droppedClassViewModels)
			{
				var classViewModel = viewModel as ClassViewModel;
				var currentPosition = diagram.GetTransformedPoint(e.GetPosition(diagram));
				if (classViewModel != null)
				{
					this.AddNewItemToDiagram(classViewModel, currentPosition, ref offset);
				}
				else
				{
					var namespaceViewModel = viewModel as NamespaceViewModel;
					foreach (var type in namespaceViewModel.Types) this.AddNewItemToDiagram(type, currentPosition, ref offset);
				}
			}

			e.Handled = true;
		}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:36,代码来源:Example.xaml.cs

示例2: OnItemDragOver

        private void OnItemDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var item = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
            if (item == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            var position = GetPosition(item, e.GetPosition(item));
            if (item.Level == 0 && position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            RadTreeView tree = sender as RadTreeView;
            var draggedData = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if ((draggedData == null && dropDetails == null))
            {
                return;
            }
            if (position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.All;

                destinationItems = item.Level > 0 ? (IList)item.ParentItem.ItemsSource : (IList)tree.ItemsSource;
                int index = destinationItems.IndexOf(item.Item);
                dropDetails.DropIndex = position == DropPosition.Before ? index : index + 1;
            }
            else
            {
                destinationItems = (IList)item.ItemsSource;
                int index = 0;

                if (destinationItems == null)
                {
                    e.Effects = DragDropEffects.None;
                }
                else
                {
                    e.Effects = DragDropEffects.All;
                    dropDetails.DropIndex = index;
                }
            }

            dropDetails.CurrentDraggedOverItem = item.Item;
            dropDetails.CurrentDropPosition = position;

            e.Handled = true;
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:53,代码来源:MainWindow.xaml.cs

示例3: OnDragOver

        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
        {
            dropPosition.Visibility = Visibility.Collapsed;
            string payloadData = DragDropPayloadManager.GetDataFromObject(args.Data, "DragData") as string;
            if (string.IsNullOrEmpty(payloadData))
            {
                return;
            }

            RadRichTextBox mainEditor = sender as RadRichTextBox;
            RadRichTextBox richTextBox = mainEditor.ActiveDocumentEditor as RadRichTextBox;

            Point point = args.GetPosition(richTextBox);
            DocumentPosition pos = richTextBox.ActiveEditorPresenter.GetDocumentPositionFromViewPoint(point);
            richTextBox.Document.CaretPosition.MoveToPosition(pos);
        }
开发者ID:jigjosh,项目名称:xaml-sdk,代码行数:16,代码来源:MainPage.xaml.cs

示例4: OnElementDragOver

 private void OnElementDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
 {
     this.currentDragPosition = e.GetPosition(this.itemsHost);
 }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:4,代码来源:OrgChartDiagram.cs

示例5: OnRowDragOver

        private void OnRowDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var row = sender as GridViewRow;
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as GridRowIndicationDetail;

            if (details == null || row == null)
            {
                return;
            }

            details.CurrentDraggedOverItem = row.DataContext;

            if (details.CurrentDraggedItem == details.CurrentDraggedOverItem)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }

            details.CurrentDropPosition = GetDropPositionFromPoint(e.GetPosition(row), row);
            int dropIndex = (this.AssociatedObject.Items as IList).IndexOf(row.DataContext);
            int draggedItemIdex = (this.AssociatedObject.Items as IList).IndexOf(DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedItem"));

            if (dropIndex >= row.GridViewDataControl.Items.Count - 1 && details.CurrentDropPosition == DropPosition.After)
            {
                details.DropIndex = dropIndex;
                return;
            }

            dropIndex = draggedItemIdex > dropIndex ? dropIndex : dropIndex - 1;
            details.DropIndex = details.CurrentDropPosition == DropPosition.Before ? dropIndex : dropIndex + 1;
        }
开发者ID:JeanNguon,项目名称:Projet,代码行数:32,代码来源:GridReorderRowBehavior.cs

示例6: OnDragOver

        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var position = e.GetPosition(sender as Canvas);

            Canvas.SetTop(this.draggedImage, position.Y - this.relativeStartPoint.Y);
            Canvas.SetLeft(this.draggedImage, position.X - this.relativeStartPoint.X);
        }
开发者ID:jigjosh,项目名称:xaml-sdk,代码行数:7,代码来源:CanvasDragDropBehavior.cs

示例7: OnItemDragOver

		private void OnItemDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
		{
			var draggedData = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
			var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
			var item = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();

			var position = GetPosition(item, e.GetPosition(item));
			if (position != DropPosition.Inside)
			{
				e.Effects = DragDropEffects.All;

				this.destinationItems = item.Level > 0 ? (IList)item.ParentItem.ItemsSource : (IList)this.AssociatedObject.ItemsSource;
				//(IList)item.ParentItem.ItemsSource != null ? (IList)item.ParentItem.ItemsSource : (IList)this.AssociatedObject.ItemsSource;
				int index = this.destinationItems.IndexOf(item.Item);
				dropDetails.DropIndex = position == DropPosition.Before ? index : index + 1;
			}
			else
			{
				this.destinationItems = (IList)item.ItemsSource;
				int index = 0;

				if (this.destinationItems == null)
				{
					e.Effects = DragDropEffects.None;
				}
				else
				{
					e.Effects = DragDropEffects.All;
					dropDetails.DropIndex = index;
				}
			}

			dropDetails.CurrentDraggedOverItem = item.Item;
			dropDetails.CurrentDropPosition = position;

			if (this.isTreeSource && this.IsChildOfSource(item))
			{
				e.Effects = DragDropEffects.None;
			}

			e.Handled = true;
		}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:42,代码来源:TreeViewDragDropBehavior.cs

示例8: TrayDropped

        private static void TrayDropped(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            RadToolBarTray destinationTray = sender as RadToolBarTray;
            DragDropInfo info = GetDragDropInfo(e.Data);
            if (destinationTray == null || info == null)
            {
                return;
            }

            var positionInfo = BandsUtilities.CalculateToolBarPositionInfo(info.ToolBar, destinationTray, e.GetPosition(destinationTray));
            if (!destinationTray.Items.Contains(info.ToolBar))
            {
                MoveToolBarToTray(info, destinationTray);
            }

            bool allowNewBandCreation = GetNewBandMode(destinationTray) != NewBandMode.None;
            BandsUtilities.UpdateToolBarPosition(destinationTray, info.ToolBar, positionInfo, allowNewBandCreation);

            ClearHitTesting(destinationTray.Items);
            HideNewBandIndicator(destinationTray);

            e.Handled = true;
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:23,代码来源:ToolBarTrayUtilities.cs

示例9: TrayDraggedOver

        private static void TrayDraggedOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            RadToolBarTray tray = sender as RadToolBarTray;
            DragDropInfo info = GetDragDropInfo(e.Data);
            if (tray == null || info == null)
            {
                return;
            }

            var positionInfo = BandsUtilities.CalculateToolBarPositionInfo(info.ToolBar, tray, e.GetPosition(tray));
            bool allowNewBandCreation = GetNewBandMode(tray) == NewBandMode.Live;
            BandsUtilities.UpdateToolBarPosition(tray, info.ToolBar, positionInfo, allowNewBandCreation);
            UpdateNewBandIndicator(info, positionInfo, tray);
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:14,代码来源:ToolBarTrayUtilities.cs

示例10: TrayDragEntered

        private static void TrayDragEntered(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            RadToolBarTray tray = sender as RadToolBarTray;
            DragDropInfo info = GetDragDropInfo(e.Data);
            if (tray == null || info == null)
            {
                return;
            }

            lastInitializedInfo = null;

            if (!tray.Items.Contains(info.ToolBar))
            {
                var positionInfo = BandsUtilities.CalculateToolBarPositionInfo(info.ToolBar, tray, e.GetPosition(tray));
                MoveToolBarToTray(info, tray);
                bool allowNewBandCreation = GetNewBandMode(tray) == NewBandMode.Live;
                BandsUtilities.UpdateToolBarPosition(tray, info.ToolBar, positionInfo, allowNewBandCreation);
                UpdateNewBandIndicator(info, positionInfo, tray);
                SetHitTesting(tray.Items);
            }

            e.Handled = true;
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:23,代码来源:ToolBarTrayUtilities.cs


注:本文中的Telerik.GetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。