I have a list of textual descriptions, each of which a user must score on a scale of 1-5. The number of textual descriptions is variable, so I can't just define a static Grid in XAML.
The following image shows approximately what I'm 开发者_StackOverflowafter:
In ASP.NET, I could bind my list of text items to a Repeater control. For each row, the text would be displayed in a Label, and next to it would be a DropDownList that contains a static list of items. Is there a similar control available in Silverlight?
Should I be using one of these?
- DataGrid
- ListBox
- Custom control derived from ItemsControl
- (Other)
I solved this by using an ItemsControl, and within the ItemTemplate I placed the TextBlock and ComboBox controls.
The only wrinkle for me was that the ComboBox depended on a separate DataContext, so I had to resort to using the DataContextProxy described in this article
精彩评论