This is a migrated thread and some comments may be shown as answers.

FindCarouselPanel is null

4 Answers 125 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Dev asked on 17 May 2012, 11:42 PM
I have the following xaml:
<telerik:RadCarousel Name="myCarousel"  HorizontalContentAlignment="Stretch" VerticalAlignment="Top" VerticalContentAlignment="Center" Height="43" Padding="0" IsSynchronizedWithCurrentItem="True" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden" Background="{x:Null}" Margin="25,0,2,0" PreviewMouseDown="effectiveDateCarousel_PreviewMouseDown" PreviewKeyDown="effectiveDateCarousel_PreviewKeyDown" PreviewMouseWheel="effectiveDateCarousel_PreviewMouseWheel">
<telerik:RadCarousel.ItemsPanel>
<ItemsPanelTemplate>
<telerik:RadCarouselPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Path="{StaticResource path}" IsSelectedTopItem="True" />
          </ItemsPanelTemplate>
</telerik:RadCarousel.ItemsPanel>
</telerik:RadCarousel>


On the UserControl loaded event I have the following:
RadCarouselPanel panel = myCarousel.FindCarouselPanel();
panel.ItemsPerPage = 7;

Most of the time this works fine. However occasionally the FindCarouselPanel will return null instead of the panel? Am I doing something wrong? Is there anything I can do to prevent this?

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 21 May 2012, 06:53 AM
Hi,

It seems that that panel is still not loaded when the UserControl loads. Would you please check what the result is if you find the panel item when the Carousel is Loaded, not the UserControl? 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dev
Top achievements
Rank 1
answered on 25 May 2012, 11:59 PM
That makes sense. I will move it there and let you know if I have anymore problems.
0
Dev
Top achievements
Rank 1
answered on 05 Jun 2012, 03:07 PM
I moved it to the Carousel loaded event and it is not null as often but it still happens. Any other ideas?
0
Dev
Top achievements
Rank 1
answered on 05 Jun 2012, 03:42 PM
I moved it to the Loaded event of the panel. I think this will fix it.
Tags
Carousel
Asked by
Dev
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Dev
Top achievements
Rank 1
Share this question
or