本文整理汇总了C#中UIElement.FindAncestor方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.FindAncestor方法的具体用法?C# UIElement.FindAncestor怎么用?C# UIElement.FindAncestor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement.FindAncestor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: return
bool IDragSourceAdvisor.IsDraggable(UIElement dragElt)
{
if (dragElt == _ListBox)
return false;
ListBoxItem listViewItem = dragElt.FindAncestor<ListBoxItem>();
return (listViewItem != null);
}
示例2: DataObject
DataObject IDragSourceAdvisor.GetDataObject(UIElement draggedElt)
{
DataObject Do = new DataObject();
Do.SetData("RawUI", draggedElt);
ListBoxItem listViewItem = draggedElt.FindAncestor<ListBoxItem>();
if (listViewItem != null)
{
Do.SetData("ListBoxItem", listViewItem);
Do.SetData("OriginalIndex", _ListBox.ItemsSource.Cast<object>().Index(listViewItem.DataContext));
}
return Do;
}
示例3: return
bool IDragSourceAdvisor.IsDraggable(UIElement dragElt)
{
if (EnableDragAndDrop == false)
return false;
if (dragElt == this.LB)
return false;
ListBoxItem lbi = dragElt.FindAncestor<ListBoxItem>();
return (lbi != null);
}
示例4: DataObject
DataObject IDragSourceAdvisor.GetDataObject(UIElement draggedElt)
{
DataObject Do = new DataObject();
ListBoxItem listViewItem = draggedElt.FindAncestor<ListBoxItem>();
Do.SetData("RawUI", listViewItem);
if (listViewItem != null)
{
listViewItem.IsSelected = true;
if (_ListBox.SelectedItems.Count == 1)
{
Do.SetData("ListBoxItem", listViewItem);
if (this.Mode == DragAndDropSourceMode.Removable)
Do.SetData("OriginalSourceIndex", _ListBox.ItemsSource.Cast<object>().Index(listViewItem.DataContext));
}
else
{
var items = _ListBox.SelectedItems.Cast<object>().ToList();
Do.SetData("SelectedItems", items);
if (this.Mode == DragAndDropSourceMode.Removable)
{
var all = _ListBox.ItemsSource.Cast<object>().ToList();
Do.SetData("OriginalSourceIndexes", items.Select(i => all.Index(i)).ToList());
}
}
}
return Do;
}
示例5: DataObject
DataObject IDragSourceAdvisor.GetDataObject(UIElement draggedElt)
{
ListBoxItem lbi = draggedElt.FindAncestor<ListBoxItem>();
DataObject dob = new DataObject("ListBoxItem", lbi);
dob.SetData("RawUI", draggedElt);
dob.SetData("OriginalIndex", this.ItemsSource.IndexOf(lbi.DataContext));
return dob;
}