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

Button click event

3 Answers 87 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
jeewan thapa
Top achievements
Rank 1
jeewan thapa asked on 24 Feb 2009, 05:12 PM
Hi,
I have a button inside a stack panel in a carousel  control and I want to fire a click event  in that button but It does nothing.
Can you please help?  I am try to pop up another window when user click on a button ( details of that particular selected item) . Moreover how do I get the ID of a selected item.
Thank you
Jeewan Thapa

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 27 Feb 2009, 10:41 AM

Hello jeewan thapa,

There is a know bug in RadCarousel that renders all elements inside a CarouselItem inactive. This bug has been fixed and the fix wll be included in our upcoming release. Actually the bug is only present in our default themes and if you define a custom style for CarouselItem it will not be a problem.
I am sending you a sample project that demontrates how you can add buttons to the carousel items, and how you can get the ID of a selected item.

All the best,

Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Maria Im
Top achievements
Rank 1
answered on 02 Nov 2009, 07:07 PM
This is what I also found. I don't think it really has to do something with the original carousel theme. You just need to change one property to true. So I have all my styles from the original theme except the fact that "IsHitTestVisble" under the CarouselDataRecordPresenter was set to false. So i could never hit any other control under it. Once I set that property to True. I was able to raise the ClickEvents for each of my buttons in the carousel.
Hope that helps someone.
  <Style TargetType="{x:Type telerik:CarouselDataRecordPresenter}">  
                <Setter Property="OverridesDefaultStyle" Value="true"/>  
                <Setter Property="Template">  
                    <Setter.Value> 
                        <ControlTemplate TargetType="{x:Type telerik:CarouselDataRecordPresenter}">  
                            <Grid IsHitTestVisible="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">  
                                <Grid.RowDefinitions> 
                                    <RowDefinition Height="30" /> 
                                    <RowDefinition Height="*" /> 
                                    <RowDefinition Height="Auto" /> 
                                </Grid.RowDefinitions> 
                                <StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" > 
                                    <Button x:Name="xxxxx" Content="test" Click="xxxxx_Click"></Button> 
                                </StackPanel> 
                                <Rectangle Grid.Row="1" RadiusX="3" RadiusY="3" Width="260" Height="350">  
                                    <Rectangle.Fill> 
                                        <ImageBrush x:Name="brush" ImageSource="Afro.jpg"/>  
                                    </Rectangle.Fill> 
                                </Rectangle> 
                                <StackPanel Grid.Row="2"  Orientation="Horizontal" VerticalAlignment="Center">  
                                    <Label Content="College: " Foreground="#ff8FB3FF" FontSize="12"/>  
                                    <Label Content="{Binding Data.College}" FontSize="12" Foreground="#ff8FB3FF"/>  
                                </StackPanel> 
                            </Grid> 
                        </ControlTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
0
Milan
Telerik team
answered on 04 Nov 2009, 09:13 AM
Hi Maria Im,

Thank you for your suggestion.


Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Carousel
Asked by
jeewan thapa
Top achievements
Rank 1
Answers by
Milan
Telerik team
Maria Im
Top achievements
Rank 1
Share this question
or