FindCarouselPanel is null

5 posts, 0 answers
  1. Tom
    Tom avatar
    38 posts
    Member since:
    Mar 2007

    Posted 17 May 2012 Link to this post

    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?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 May 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Tom
    Tom avatar
    38 posts
    Member since:
    Mar 2007

    Posted 25 May 2012 Link to this post

    That makes sense. I will move it there and let you know if I have anymore problems.
  5. Tom
    Tom avatar
    38 posts
    Member since:
    Mar 2007

    Posted 05 Jun 2012 Link to this post

    I moved it to the Carousel loaded event and it is not null as often but it still happens. Any other ideas?
  6. Tom
    Tom avatar
    38 posts
    Member since:
    Mar 2007

    Posted 05 Jun 2012 Link to this post

    I moved it to the Loaded event of the panel. I think this will fix it.
Back to Top
UI for WPF is Visual Studio 2017 Ready