开发者

Is it possible in WPF to have a Panel and be able to add UserControls to it (Similar to Windows Forms)?

I'm going to be making a user control for person information, I will then populate a panel o开发者_Go百科f some sort with the ammount of people found (one user control for each person).

Can WPF handle this?


You can do this, but it is not necessarily the best option.

Instead of putting in controls per person, you can use an ItemTemplate that describes how to render a "Person". You can then just bind a (standard) ItemsControl, such as a ListBox or ListView to your collection of people directly, and WPF will handle wiring it up for you.

For details, I'd recommend reading up on Data Binding on MSDN, in particular, "Binding to Collections."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜