开发者

How to Bind Grid with Properties in Code behind?

I have a grid in a XAML file and I want to generate its RowDefinition dynamically开发者_高级运维. To do that I create a List<RowDefinition> in which I add 3-4 RowDefinitions. Now I have to bind this property to the grid in the XAML file. How do I do this?


If you want to host dynamic content (varying number of items), the Grid control might not be your best option. Try using an ItemsControl (which can be templated to look however you want) and bind your actual data against the ItemsSource property. If you post some more information about what kind of content you are looking to display I can give you an example of how to do it with an ItemsControl.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜