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 RowDefinition
s. 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.
精彩评论