本文整理汇总了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;
}
示例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;
}
示例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);
}
示例4: OnElementDragOver
private void OnElementDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
this.currentDragPosition = e.GetPosition(this.itemsHost);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}