private void _list_PreviewTouchDown(object sender, TouchEventArgs e)
{
if (e.Handled)
return;
if (!touch_points.ContainsKey(e.TouchDevice.Id))
{
touch_info t = new touch_info();
t.id = e.TouchDevice.Id; t.is_tap = true; t.points.Add(e.GetTouchPoint(this._list as IInputElement));
try { t.initial_attended_item = (Control)e.Source; }
catch (Exception) { }
this.touch_points.Add(e.TouchDevice.Id, t);
}
else
{
}
FadingScrollViewer scroll = configurations.GetDescendantByType(this._list, typeof(FadingScrollViewer)) as FadingScrollViewer;
if (is_horizontal)
last_scroll_offset = scroll.HorizontalOffset;
else
last_scroll_offset = scroll.VerticalOffset;
//scroll.Elasticity = new Vector(0.0, 0.4);
if (configurations.right_panel_drag)
{
UIElement dragged_item = null;
if (collection_list)
dragged_item = HitTestOverItem(e, true, false, false, true);
else
dragged_item = HitTestOverItem(e, true, true, false, false);
if (dragged_item != null)
{
//avatar_drag(element, e.TouchDevice);
bool result = false;
if (dragged_item.GetType() == Type.GetType("nature_net.user_controls.item_generic_v2"))
result = start_drag((item_generic_v2)dragged_item, e);
if (dragged_item.GetType() == Type.GetType("nature_net.user_controls.collection_listbox_item"))
result = start_drag((collection_listbox_item)dragged_item, e.TouchDevice);
touch_points[e.TouchDevice.Id].is_drag = true;
touch_points[e.TouchDevice.Id].points.Clear();
touch_points[e.TouchDevice.Id].consecutive_drag_points = 0;
e.Handled = true;
touch_points.Remove(e.TouchDevice.Id);
return;
}
}
if (configurations.manual_scroll)
{
bool r = e.TouchDevice.Capture(this._list as IInputElement, CaptureMode.SubTree);
e.Handled = true;
touch_points.Remove(e.TouchDevice.Id);
return;
}
if (touch_points[e.TouchDevice.Id].initial_attended_item != null)
attend_on_item(true, touch_points[e.TouchDevice.Id].initial_attended_item);
}