FindCarouselPanel in RadCarousel

3 posts, 0 answers
  1. KocSistem
    KocSistem avatar
    25 posts
    Member since:
    Sep 2008

    Posted 30 Dec 2008 Link to this post


    Hello ,

    I have a problem about the method FindCarouselPanel().
    Here is the code i wrote:

     

     

     

    <Style x:Key="RadCarouselStyle1" TargetType="{x:Type telerik:RadCarousel}">  
                <Style.BasedOn> 
                    <Style TargetType="{x:Type telerik:RadCarousel}">  
                        <Setter Property="Template">  
                            <Setter.Value> 
                                <ControlTemplate TargetType="{x:Type telerik:RadCarousel}">  
                                    <Grid> 
                                        <Grid.ColumnDefinitions> 
                                            <ColumnDefinition Width="50*" /> 
                                            <ColumnDefinition Width="50*" /> 
                                        </Grid.ColumnDefinitions> 
     
                                        <Button x:Name="EnSolItem" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Column="0" Width="40" Height="40" Margin="0,0,40,0" Content="EnSol" /> 
                                        <Button x:Name="SolItem" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Column="0" Width="40" Height="40" Content="Sol" /> 
     
                                        <Button x:Name="SagItem" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Column="1" Width="40" Height="40" Content="Sağ" /> 
                                        <Button x:Name="EnSagItem" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Column="1" Width="40" Height="40" Margin="40,0,0,0"  Content="EnSağ" /> 
     
                                        <Border Grid.ColumnSpan="2"  Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="{TemplateBinding BorderThickness}">  
     
                                            <telerik:CarouselItemsControl x:Name="PART_RootItemsControl"  Grid.ColumnSpan="2"/>  
                                        </Border> 
                                    </Grid> 
                                </ControlTemplate> 
                            </Setter.Value> 
                        </Setter> 
                        <Setter Property="ClipToBounds" Value="True"/>  
                    </Style> 
                </Style.BasedOn> 
            </Style> 

    this is the template i'm using,

     

     

     

    <telerik:RadCarousel x:Name="radCarousel"  Style="{DynamicResource RadCarouselStyle1}"/>

    In my code Behind, I have an event handler and a function to give the path and etc.

     

    void radCarousel_Loaded(object sender, RoutedEventArgs e)  
            {  
                Telerik.Windows.Controls.RadCarouselPanel panel = this.radCarousel.FindCarouselPanel();  
                this.radCarousel.ReflectionSettings.Visibility = Visibility.Visible;  
                this.radCarousel.ReflectionSettings.OffsetX = 0;  
                this.radCarousel.ReflectionSettings.OffsetY = 5;  
                this.radCarousel.ReflectionSettings.HiddenPercentage = 0;  
                this.radCarousel.ReflectionSettings.Opacity = 0.5;  
                this.radCarousel.ReflectionSettings.HeightOffset = 0;  
                this.radCarousel.ReflectionSettings.WidthOffset = 0;  
                this.radCarousel.ReflectionSettings.Angle = 0;  
     
                System.Windows.Shapes.Path path = CreateLinePath();  
     
                if (panel != null)  
                {  
                    this.radCarousel.FindCarouselPanel().Path = path;  
                    this.radCarousel.FindCarouselPanel().ItemsPerPage = 7;  
                }  
            }  
     
            private System.Windows.Shapes.Path CreateLinePath()  
            {  
                System.Windows.Shapes.Path newPath = new System.Windows.Shapes.Path();  
                PathFigureCollectionConverter figureConverter = new PathFigureCollectionConverter();  
                object geometryFigures = figureConverter.ConvertFromString("M30,200 L307.5,200");  
                PathGeometry newGeometry = new PathGeometry();  
                newPath.Stretch = Stretch.Fill;  
                BrushConverter brushConverter = new BrushConverter();  
                newPath.Stroke = (System.Windows.Media.Brush)brushConverter.ConvertFromString("#FF0998f8");  
                newPath.StrokeThickness = 2;  
                newGeometry.Figures = (PathFigureCollection)geometryFigures;  
                newPath.Data = (Geometry)newGeometry;  
                return newPath;  
            } 

     

     


    While i'm setting the 

     

     

     

    this.radCarousel.FindCarouselPanel().Path = path;

     

     

     

    this.radCarousel.FindCarouselPanel().ItemsPerPage = 7;
    part, FindCarouselPanel() returns null. Yesterday it was working. I didn't changed anything except the Style of radCarousel. Should i be implementing the RadCarouselPanel to style as well?
    Please help.

     

     

     

     

     

  2. KocSistem
    KocSistem avatar
    25 posts
    Member since:
    Sep 2008

    Posted 30 Dec 2008 Link to this post

    Anyway i found out that Resources in my Grid was effecting my RadCarousel. There is still a wierd thing in this situation, the exact same code was working fine yesterday.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Hristo Deshev
    Admin
    Hristo Deshev avatar
    559 posts

    Posted 30 Dec 2008 Link to this post

    Hello,

    There is no need to style the RadCarouselPanel. Moreover, as far as I can tell there is no problem with the style that you have created. I pasted it in my own project and it worked perfectly.
    Something else must have gone wrong in your application.

    I am sending you the project that I have used to test your custom style - it might help you solve your problem.

    Of course, if you are unable to find a solution you may open a support ticket and send us your application so that we can take a look at it.

    Best wishes,
    Hristo Deshev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top