RadTileElement events not firing....

2 posts, 0 answers
  1. Info
    Info avatar
    2 posts
    Member since:
    Sep 2012

    Posted 17 Aug 2012 Link to this post

    Hi,

    I have started to write some code that eventually will build a menu of tiles using the Panaroma, Group and Tile controls. The strange thing is that when I add the tiles directly to the panorama everything works fine but when I first add the group and then add the tiles to the group then everything is shown ok but the tile events are not firing. There is no reponse to a click event or a mouse over. Could you help me with this?
    Private Sub Menu_Load(sender As Object, e As System.EventArgs) Handles Me.Load
     
            Dim i As Integer
            Dim r As Integer
            Dim c As Integer = 0
     
            Dim groep As New TileGroupElement
     
            groep.Text = "hoi"
            RadPanorama1.Items.Add(groep)
     
            For i = 0 To 45
     
                If i Mod 4 = 0 Then
                    If i <> 0 Then
                        r = r + 1
                    End If
     
                End If
     
                groep.RowsCount = r + 1
     
                Dim tile As New RadTileElement
                tile.Text = CStr(i)
     
                tile.Row = r
     
                tile.Column = c
     
                c = c + 1
     
                If c = 4 Then c = 0
     
                tile.Tag = i
     
                AddHandler tile.Click, AddressOf tile_click
     
                groep.Items.Add(tile)
     
            Next
     
            Me.RadPanorama1.AllowDragDrop = False
     
            groep.ShouldHandleMouseInput = True
     
        End Sub
     
        Private Sub tile_click(sender As System.Object, e As System.EventArgs)
            RadPanorama1.PanoramaElement.SuspendLayout(True)
            MessageBox.Show(CType(sender, RadTileElement).Tag)
            RadPanorama1.PanoramaElement.ResumeLayout(True, True)
        End Sub
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 21 Aug 2012 Link to this post

    Hi,

    Thank you for writing.

    The groups in RadPanorama should be added to the Groups collection of the control, not to the Items collection. Additionally, you should set the ShowGroups property to true:
    Private Sub Menu_Load(sender As Object, e As System.EventArgs) Handles Me.Load
           RadPanorama1.ShowGroups = True
     
           Dim i As Integer
           Dim r As Integer
           Dim c As Integer = 0
     
           Dim groep As New TileGroupElement
     
           groep.Text = "hoi"
           RadPanorama1.Groups.Add(groep)
     
           For i = 0 To 45
     
               If i Mod 4 = 0 Then
                   If i <> 0 Then
                       r = r + 1
                   End If
     
               End If
     
               groep.RowsCount = r + 1
     
               Dim tile As New RadTileElement
               tile.Text = CStr(i)
     
               tile.Row = r
     
               tile.Column = c
     
               c = c + 1
     
               If c = 4 Then c = 0
     
               tile.Tag = i
     
               AddHandler tile.Click, AddressOf tile_click
     
               groep.Items.Add(tile)
     
           Next
     
           Me.RadPanorama1.AllowDragDrop = False
     
           groep.ShouldHandleMouseInput = True
     
       End Sub
     
       Private Sub tile_click(sender As System.Object, e As System.EventArgs)
           RadPanorama1.PanoramaElement.SuspendLayout(True)
           MessageBox.Show(CType(sender, RadTileElement).Tag)
           RadPanorama1.PanoramaElement.ResumeLayout(True, True)
       End Sub

    We will consider throwing an exception when one attempts to add group to the Items collection in a future release. I have added a feature request here: http://www.telerik.com/support/pits.aspx#/public/winforms/12369.

    Your Telerik Points have been updated accordingly.
     
    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top