This project is read-only.

Dynamically add to FlowControl?

Oct 22, 2014 at 8:19 PM
Hey guys!

I am dynamically generating buttons based on the results of a SQL query.. I am binding the collection of objects to a ItemsControl and they are rendering.. but would rather make use of the smarts of the CODE flowcontrol. Is there a way to add controls dynamically to this control to make use of its auto -layout properties?

Oct 23, 2014 at 8:57 AM
Yes, absolutely. You can add to it just like any other control in WPF. It is a subclass of a panel control (if memory serves me right), so it has a Children collection you can programmatically add to. If you happen to be using the flow control as a style for an items control (such as a view) then you can simply programmatically add to the items of the items control and the benefits of the flow control will automatically apply.