More complexity with ListBox not works

Dec 27, 2011 at 5:53 PM

Playing with this example, i have found, that more complex templates works not correctly:

  • I have add a ChildNames property to EmployeeReviewReportItem:
public string[] ChildNames { set; get; }

  • in ReportData.cs set value for this property:
ChildNames = new string[] { firstNames.Random(), firstNames.Random(), firstNames.Random() }
  • in MainPage.xaml a new ListBox to show this prperty:
...
   
<TextBlock Grid.Row="2"
                                   
Grid.ColumnSpan="4"
                                   
TextWrapping="Wrap"
                                   
Text="{Binding ReviewComments}" />

                           
<ListBox Grid.Row="3" Grid.ColumnSpan="4" ItemsSource="{Binding ChildNames}">
                             
<ListBox.ItemTemplate>
                               
<DataTemplate>
                                       
<TextBlock Width="300"
                                                       
Height="auto"
                                                       
VerticalAlignment="Top"
                                                       
Text="{Binding .}"
                                                       
TextWrapping="Wrap" />
                               
</DataTemplate>
                            </
ListBox.ItemTemplate>
                       
</ListBox>
                    </
Grid>
...

ListBox will be rendered without content.

How i can get Child names printed?
Coordinator
Jan 6, 2012 at 3:11 PM

I'll look into this, but as a simple reporting example, I really didn't expect people to put ListBox elements in the printed report.

Can you tell me more about what you're looking to accomplish?

Pete