I have an application that I wrote long ago in SL 3.x. I have converted it all over to SL 5. Everything works EXCEPT one part. I have a WrapPanel whose children I add dynamically at runtime. I can see in the debugger that everything appears to be okay, no null objects, no complaints in the output window, but I see no content of my WrapPanel child. I can tell that the child was added because the control grows, but nothing shows.
Here is my UserControl:
<UserControl x:Class="EDBSilverlight.CommonParts.LegendItem" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="White" > <Grid x:Name="LayoutRoot" Margin="4,2,4,2" > <TextBlock Text="test" Foreground="Black" FontSize="24" /> </Grid></UserControl>
Here is my code to create instances at runtime:
procedure CreateLegend; begin var legendItem := new LegendItem; SaveRatmChart.MyLegendPanel.Children.Add( legendItem ); end;
The LegendItem never shows. I added a button to create new ones and I can see that the MyLegendPanel which is just a WrapPanel is growing in size and seems to show the content I add. It is like the LegendItem doesn't paint itself for some reason when it first displays that is beyond me.
Here is that LegendPanel:
<my3:WrapPanel
x:Name="MyLegendPanel" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="50,0,50,0" />
This code worked in SL 3.x.