I'm getting a the following error when I use Interactivity
:
Error Collection property 'System.Windows.Controls.Canvas'.'Triggers' is null.
Here's my code:
<ItemsControl x:Name="StreamCanvasItemSource" ItemsSource="{Binding StreamCanvasItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="{Binding ActualWidth, ElementName=StreamImage}" Height="{Binding ActualHeight, ElementName=StreamImage}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas x:Name="StreamCanvas" Background="Transparent" Width="{Binding ActualWidth, ElementName=StreamImage}" Height="{Binding ActualHeight, ElementName=StreamImage}"
AuxiliaryUtils:SizeObserver.Observe="True" AuxiliaryUtils:SizeObserver.ObservedWidth="{Binding CurrentCanvasWidth, Mode=OneWayToSource}"
AuxiliaryUtils:SizeObserver.ObservedHeight="{Binding CurrentCanvasHeight, Mode=OneWayToSource}"
AuxiliaryUtils:SizeObserver.ObservedLeft="{Binding CanvasLeft, Mode=OneWayToSource}" AuxiliaryUtils:SizeObserver.ObservedTop="{Binding CanvasTop, Mode=OneWayToSource}">
<Interactivity:Interaction.Triggers>
<Interactivity:EventTrigger EventName="PreviewMouseWheel">
<Command:EventToCommand Command="{Binding OnMouseWheelCommand}" PassEventArgsToCommand="True" />
</Interactivity:EventTrigger>
<Interactivity:EventTrigger EventName="PreviewMouseDown">
<Interactivity:InvokeCommandAction Command="{Binding OnMouseDownCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Canvas}}}"/>
</Interactivity:EventTrigger>
<Interactivity:EventTrigger EventName="PreviewMouseMove">
<Interactivity:InvokeCommandAction Command="{Binding OnMouseMoveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Canvas}}}"/>
</Interactivity:EventTrigger>
<Interactivity:EventTrigger EventName="PreviewMouseUp">
<Interactivity:InvokeCommandAction Command="{Binding OnMouseUpCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Canvas}}}"/>
</Interactivity:EventTrigger>
</Interactivity:Interaction.Triggers>
</Canvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
The thing is that everything works as expected when I run the program, I see the error when compiling, and I can't see the designer unless I comment the Interactivity
block.
Any idea why?