c# - Add variable number of control -


i relatively new wpf, can point me best methodology please?

i creating block diagram lines linking blocks. boxes in row thinking of horizontally aligned stack panel rectangles , lines.

the rectangles fill tab page, , clickable.

the problem don't know until run-time how many rectangles there be.

what right way this, should in code-behind find out number of rectangles , add , position them , lines in code or can in xaml bit more flexibility?

the number of rectangles be between 2 , 10, if 2 wouldn't want them filling whole width of tab. ideally rectangle have min , max width , centered still looks quite nice.

many in advance

the right way use <itemscontrol> , bind itemssource part of model represents collection of diagram blocks. data binding pretty powerful part of wpf. unfortunately, complex describe in answer, recommend read articles/code samples speed it.

if use observablecollection<diagramblock> (or other collection implements inotifycollectionchanged) blocks, adding or removing blocks in code cause ui change accordingly.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -