I have app with xaml code:
<GridView
AllowDrop="True" CanReorderItems="True"
CanDragItems="True" ItemsSource="{Binding myItems}"
ReorderMode="{Binding IsReorderEnabled}"
ItemContainerStyle="{StaticResource GridViewItemStyle1}"
cm:Message.Attach="[Event DragItemsStarting] = [Action DragItemsStarting($source, $eventArgs)]">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Horizontal" MaximumRowsOrColumns="3" HorizontalChildrenAlignment="Left" VerticalChildrenAlignment="Center" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemTemplate>
<DataTemplate>
<Grid Height="100"
Width="100"
cm:Message.Attach="[Event Tapped] = [Action ItemTapped()];
[Event Holding] = [Action ItemHolding()];
[Event Drop] = [Action ItemDrop()];
[Event DragOver] = [Action ItemDragOver($source, $eventArgs)]">
<Grid cm:Message.Attach="[Event PointerReleased] = [Action ItemPointerReleased($source, $eventArgs)];
[Event PointerCaptureLost] = [Action ItemPointerCaptureLost($source, $eventArgs)];
[Event PointerCanceled] = [Action ItemPointerCanceled($source, $eventArgs)];
[Event PointerEntered] = [Action ItemPointerEntered($source, $eventArgs)];
[Event PointerExited] = [Action ItemPointerExited($source, $eventArgs)]">
<Image
Source="{Binding ItemImage}"
MinHeight="30" MinWidth="30"
Stretch="Fill"/>
</Grid>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
The problem is a more count of events, which I signed with the Caliburn.Micro. If i use only one or two event, for example:
<DataTemplate>
<Grid Height="100"
Width="100"
cm:Message.Attach="[Event Tapped] = [Action ItemTapped()]">
<Grid cm:Message.Attach="[Event PointerEntered] = [Action ItemPointerEntered($source, $eventArgs)];
[Event PointerExited] = [Action ItemPointerExited($source, $eventArgs)]">
<Image
Source="{Binding ItemImage}"
MinHeight="30" MinWidth="30"
Stretch="Fill"/>
</Grid>
</Grid>
</DataTemplate>
its working fine! And if I use the full code, sometimes uwp my application crashes:
The DependencyProperty target is invalid: Windows.UI.Xaml.Controls.Grid
and random error:
"System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.\r\n
at Windows.UI.Xaml.Media.VisualTreeHelper.GetParent(DependencyObject reference)\r\n
at Caliburn.Micro.ActionMessage.<>c.<.cctor>b__34_7(ActionExecutionContext context)\r\n
at Caliburn.Micro.ActionMessage.<>c.<.cctor>b__34_8(ActionExecutionContext context)\r\n
at Caliburn.Micro.ActionMessage.UpdateContext()\r\n
at Caliburn.Micro.ActionMessage.ElementLoaded(Object sender, RoutedEventArgs e)\r"
What's the best way to solve my problem? Best practice for Caliburn.Micro?