views:

119

answers:

1

In a WPF application I have an ObservableCollection of objects (areas on an image) that I want to display and edit (size and position) at runtime.

I would like to use an InkCanvas in Select mode with Rectangles representing my objects, but it doesn't seem to directly support data binding.

Is it possible to somehow bind the Children collection of an InkCanvas to an ObservableCollection?

+1  A: 

Have you tried using a ItemsControl with a Canvas set as ItemsControl.ItemsPanel? Then you can bind the ItemsSource property to your ObservableCollection. You can then use a ItemsControl.ItemsTemplate to bind a property of an item to the Canvas.Left (Right) Properties for absolute placement.

redoced