Я обычно просто копирую атрибуты, изменяясь независимо от того, что мне нужно изменение:
new_user = User.new(old_user.attributes.merge(:login => "newlogin"))
Примерно так (непроверено):
private object GetObjectDataFromPoint(ItemsControl source, Point point)
{
//translate screen point to be relative to ItemsControl
point = _itemsControl.TranslatePoint(point);
//find the item at that point
var item = _itemsControl.InputHitTest(point) as FrameworkElement;
return item.DataContext;
}
private object GetObjectDataFromPoint(ItemsControl source, Point point)
{
//translate screen point to be relative to ItemsControl
point = source.TranslatePoint(point, source);
//find the item at that point
var item = source.InputHitTest(point) as FrameworkElement;
return item.DataContext;
}