Hi,
I am writing some C# WPF code (trying to stick to MVVM model) I need to display a CVB image with a variable number of rectangle overlays (added in dynamically in code, not moveable/resizable) and also draw an AOI (rectangular and can be moved/resized by the user).
I am using the WPF Display, also tried the DisplayCanvas. I can get two of the 3 parts working, but not all together. For example, if in XAML I do:
<cvb:DisplayCanvas Image="{Binding MyImage}">
<cvb:RectSelectOverlay SelectedRect="{Binding MySelectedRect, Mode=TwoWay}" />
</cvb:DisplayCanvas>
I can display the image, and I can draw an AOI.
If I use this structure:
<ItemsControl ItemsSource="{Binding Overlays}" Margin="5,5,5,5">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<cvb:DisplayCanvas Image="{Binding MyImage}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
Where: public ObservableCollection<ImageOverlay> Overlays { get;set; };
I can display an image, and add multiple overlays, normally RectangleOverlays
. These all display correctly, but if I set one to be resizable and movable, the cursor changes (as if it is going to move) but it does not.
I have also tried adding one RectSelectOverlay
to the collection and it does not display at all.
Am I going about this the right way, I am fairly new to WPF/MVVM and there always appears more than 1 way to do anything!!
Thanks,
Stephen