Button click event

4 posts, 0 answers
  1. jeewan thapa
    jeewan thapa avatar
    4 posts
    Member since:
    Apr 2006

    Posted 24 Feb 2009 Link to this post

    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
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 27 Feb 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Maria Im
    Maria Im avatar
    10 posts
    Member since:
    Sep 2012

    Posted 02 Nov 2009 Link to this post

    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> 
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 04 Nov 2009 Link to this post

    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.
Back to Top