Eli Perpinyal
Eli Perpinyal

Reputation: 1736

Binding a list of controls to a canvas

Is it possible to bind an OvservableCollection of Labels or and FrameworkElement to a canvas? If so how can this be implemented?

Upvotes: 1

Views: 1631

Answers (1)

japf
japf

Reputation: 6718

You can use an ItemsControl and set its ItemsPanel property to a Canvas:

<ItemsControl ItemsSource={Binding Items}>
  <ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
      <Canvas/>
    </ItemsPanelTemplate>
  </ItemsControl.ItemsPanel>
</ItemsControl>

Hope this help

Upvotes: 2

Related Questions