This project is read-only.

AccordionItem content is not expanding when clicked


I have the following code to add a content to a single Accordion Item when it's selected:
Grid grd = new Grid();
grd.Background = Brushes.Black;

ColumnDefinition colDef = new ColumnDefinition();
colDef.Width = new GridLength(4, GridUnitType.Star);

ColumnDefinition colDef2 = new ColumnDefinition();
colDef2.Width = new GridLength(1, GridUnitType.Star);

Style stlName = this.FindResource("lblChamp") as Style;
Style stlFav = this.FindResource("imgChamp") as Style;

foreach (ChampsBySport champ in champs)
    RowDefinition rDef = new RowDefinition();

    Label lbl = new Label();
    lbl.Content = champ.title;
    lbl.ToolTip = champ.title;
    lbl.Style = stlName;
    lbl.Name = "lblChamp" + champ.champ_id;
    lbl.MouseEnter += new MouseEventHandler(lblChamp_MouseEnter);

    Grid.SetRow(lbl, grd.RowDefinitions.Count - 1);

    Image img = new Image();
    img.Style = stlFav;
    img.Source = new BitmapImage(new Uri("../img/menu/fav.png", UriKind.Relative));
    img.Name = "imgChamp" + champ.champ_id;

    Grid.SetRow(img, grd.RowDefinitions.Count - 1);

accItem.Content = grd;

accMain.Height += grd.ActualHeight;
accItem is an Accordion Item that is selected and accMain is my main Accordion.
This code is not stable. It doesn't work all the time. I mean sometimes I click the Accordion Item and it expands perfectly, but some other times when there is still a lot of content it doesn't show nothing when selected. There is no exception thrown. What is wrong with this code? Am I missing something?